View Single Post
Old 01-27-2021, 05:09 PM   #1
A-Lagopus
Member
A-Lagopus began at the beginning.
 
Posts: 10
Karma: 10
Join Date: Jan 2021
Device: iPad
Adding requests to calibre?

Hi,

I'm trying to convert cal2ky3 plugin to python3, because it's awesome and the author hasn't been active for a while.

This plugin uses http (http.client in python3) library to upload books to KyBook's web interface, and there's a nasty str and byte-mixing that worked in python2 but doesn't in python3.
I'm pretty sure it's this problem: link
But simply dumping everything into a byte string gives me Internal Server Error, probably due to different encodings but I'm not sure.

Every time I google something about http.client, someone suggets using requests instead, but calibre doesn't have this module installed. Installing it on my python environment doesn't help. I have read the documentation for calibre plugins but couldn't find anything on this topic.

Question - is there a way to add requests to calibre to circumvent the whole thing? Can it be imported from a plugin? I tried for a couple of evenings but I'm stuck because plugins are apparently .zipped when loaded into calibre.

Thanks for any help!
A-Lagopus is offline   Reply With Quote