View Single Post
Old 05-02-2024, 01:03 PM   #160
sgmoore
Connoisseur
sgmoore reads XML... blindfoldedsgmoore reads XML... blindfoldedsgmoore reads XML... blindfoldedsgmoore reads XML... blindfoldedsgmoore reads XML... blindfoldedsgmoore reads XML... blindfoldedsgmoore reads XML... blindfoldedsgmoore reads XML... blindfoldedsgmoore reads XML... blindfoldedsgmoore reads XML... blindfoldedsgmoore reads XML... blindfolded
 
Posts: 59
Karma: 52636
Join Date: Mar 2021
Device: Kindle Voyage
Quote:
Originally Posted by Pjama View Post
Thanks - I am in the python code behind the scenes and reviewing the lines of the files quoted in my error response. But I can't find where to get the code you posted above with the url object etc. Can you please tell me where I can find this?

Thanks so much
The plugin does not display capture the requests and responses unless you are running in debug mode. (In windows, you can press Ctrl-Shift-R to restart in debug-mode and when you close down, calibre will open the log in notepad)


The relevant lines of code are from https://github.com/ping/libby-calibr...client.py#L820

Code:
    
        download_base, meta = self.prepare_loan(loan)
        # contains nav/toc and spine, manifest
        openbook = self.send_request(meta["urls"]["openbook"])
        rosters: List[Dict] = self.send_request(meta["urls"]["rosters"])
The first line 820 calls self.prepare_loan(loan) and this fires a request to overdrive. If you are running in debug mode you should see a line starting with

Code:
[overdrive_libby/0.1.9] REQUEST: GET https://sentry-read.svc.overdrive.com/open/magazine/card/
followed a few lines later by a line starting

Code:
[overdrive_libby/0.1.9] RESPONSE: 200 https://sentry-read.svc.overdrive.com/open/magazine/card/
This has a few lines of headers and then the body which will start with a line like

Code:
[overdrive_libby/0.1.9] RES BODY: {"urls":{"web":

It is this body that is assigned to the variable meta on line 820 and of course if the body does not have a url for openbook then line 822 will blow up.
sgmoore is offline   Reply With Quote