Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre > Recipes

Notices

Reply
 
Thread Tools Search this Thread
Old 05-12-2020, 03:40 AM   #1
Kleki
Connoisseur
Kleki doesn't litterKleki doesn't litter
 
Posts: 58
Karma: 192
Join Date: Mar 2009
Location: Cologne area, Germany
Device: Pocketbook Touch HD3 (+ an old Hanlin V3)
debug mechanize

Hi,

I tried to add a login to the FAZ recipe. The added code seems to work in principle. I had some error messages related to syntax I was able to fix. When I change the form ID to something other than the actual ID I get an error message, so I believe the form is processed.

However, the downloaded news are the ones for not logged in users (only showing the first couple of paragraphs).

Is there a way to log what is sent forth and back between Calibre and the news site, the http requests and responses? Can I view the saved cookies somewhere?

Appreciate any hint on how to debug my recipe.
Kleki is offline   Reply With Quote
Old 05-12-2020, 03:46 AM   #2
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 45,345
Karma: 27182818
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
https://mechanize.readthedocs.io/en/...l#http-headers
kovidgoyal is offline   Reply With Quote
Advert
Old 05-12-2020, 12:13 PM   #3
Kleki
Connoisseur
Kleki doesn't litterKleki doesn't litter
 
Posts: 58
Karma: 192
Join Date: Mar 2009
Location: Cologne area, Germany
Device: Pocketbook Touch HD3 (+ an old Hanlin V3)
Thanks Kovid,

I'm novice to Calibre. While I have some history of programming this is my first exposure to Python and I don't have any development environment set up here.

I'm just using the UI to run the recipe and see the result. Adding those lines I believe you suggested does not add any additional data to the output in the jobs overview.

I simply added this to the recipe, not sure if I should have done any modification:

Code:
import sys, logging
logger = logging.getLogger("mechanize")
logger.addHandler(logging.StreamHandler(sys.stdout))
logger.setLevel(logging.DEBUG)
I'd appreciate any help in how and where I see the debug output or some instructions if I need to use any command line or debug mode to be able to do so.
Kleki is offline   Reply With Quote
Old 05-12-2020, 12:25 PM   #4
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 45,345
Karma: 27182818
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
You need to override get_browser() in the recipe, like this:

Code:
    def get_browser(self, *args, **kwargs):
        browser = BasicNewsrecipe.get_browser(self, *args, **kwargs)
        browser.set_debug_http(True)
        browser.set_debug_responses(True)
        browser.set_debug_redirects(True)
        return browser
kovidgoyal is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Ctrl-Shft-R Debug vs calibre-debug -g JimmXinu Development 3 11-20-2014 09:57 AM
Results of debug hlhalliburton Calibre 1 06-07-2011 12:36 AM
mechanize.py error when logging in to subscribed articles janvanmaar Calibre 9 11-02-2010 04:10 PM
calibre-0.6.31, mechanize and lxml taurnil Calibre 5 01-01-2010 07:47 AM
'mechanize' module? itimpi Calibre 2 01-22-2009 03:42 PM


All times are GMT -4. The time now is 09:20 PM.


MobileRead.com is a privately owned, operated and funded community.