![]() |
#1 |
Connoisseur
![]() ![]() 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. |
![]() |
![]() |
![]() |
#2 |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,345
Karma: 27182818
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
|
![]() |
![]() |
Advert | |
|
![]() |
#3 |
Connoisseur
![]() ![]() 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) |
![]() |
![]() |
![]() |
#4 |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 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 |
![]() |
![]() |
![]() |
|
![]() |
||||
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 |