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 02-14-2011, 09:25 PM   #1
EW1(SG)
Junior Member
EW1(SG) began at the beginning.
 
Posts: 4
Karma: 10
Join Date: Feb 2011
Device: Kindle
How do I handle PHPSESSID cookie?

After Starson17 pointed me in the right direction yesterday with some debug functions in Google Reader, I've managed to progress to the point where I am getting logged into a subscription only site~only to find that the session cookie(s) are not being sent to the server when my recipe gets around to downloading articles.

I was thinking that cookies = mechanize.CookieJar()
br = mechanize.build_opener(mechanize.HTTPCookieProcess or(cookies))

would handle sending the PHPSESSID cookie back to the server, but that doesn't seem to be so.

So what should I be using to get the sessions to persist for the feed downloads?

Thank you, and I promise to put python on my list of things to do...
EW1(SG) is offline   Reply With Quote
Old 02-15-2011, 08:54 AM   #2
Starson17
Wizard
Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.
 
Posts: 4,004
Karma: 177841
Join Date: Dec 2009
Device: WinMo: IPAQ; Android: HTC HD2, Archos 7o; Java:Gravity T
Quote:
Originally Posted by EW1(SG) View Post
After Starson17 pointed me in the right direction yesterday with some debug functions in Google Reader, I've managed to progress to the point where I am getting logged into a subscription only site~only to find that the session cookie(s) are not being sent to the server when my recipe gets around to downloading articles.
Cookies should be handled automatically. CookieJar is for where you need manual/direct control to delete or modify cookies (which so far, I've never needed to do). IIRC, the debug functions should show them being set and sent. Which part isn't working?
Starson17 is offline   Reply With Quote
Advert
Old 02-24-2011, 09:31 PM   #3
EW1(SG)
Junior Member
EW1(SG) began at the beginning.
 
Posts: 4
Karma: 10
Join Date: Feb 2011
Device: Kindle
What appears to be happening is that a new PHPSESSID cookie is generated for each article than I am trying to download, and since the builtin recipe doesn't seem to handle them~the session generated for each article is not available when the request to download it is sent, so no content is retrieved.
EW1(SG) is offline   Reply With Quote
Old 02-25-2011, 09:15 AM   #4
Starson17
Wizard
Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.
 
Posts: 4,004
Karma: 177841
Join Date: Dec 2009
Device: WinMo: IPAQ; Android: HTC HD2, Archos 7o; Java:Gravity T
Quote:
Originally Posted by EW1(SG) View Post
What appears to be happening is that a new PHPSESSID cookie is generated for each article than I am trying to download, and since the builtin recipe doesn't seem to handle them~the session generated for each article is not available when the request to download it is sent, so no content is retrieved.
I find that I can always track what's happening by comparing Calibre's operation (using the debugging code I gave you) with what happens in Firefox (using TamperData, Live HTTP Headers or the like). I strongly suspect you are missing something. Cookies seem to be handled well by recipes, but if they aren't you can use manual control.

A debugging approach I've found works well is to try to simulate in Firefox what I "think" is happening in the recipe. Until I can make FF do the same thing, I usually haven't figured out what's wrong in the recipe. It may be a header, a referer, or some other detail. I'm not saying you're wrong about it being cookies, just that each time I thought that, it turned out to be something else and the recipe was handling cookies just fine.

Good luck.
Starson17 is offline   Reply With Quote
Reply

Tags
phpsessid, session cookie


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
The MR Holiday Cookie Exchange taming Lounge 8 12-03-2010 01:13 PM
PocketBook 302 Cookie in UK! jules_july PocketBook 1 05-14-2010 01:31 PM
Cookie / Login Trouble? Read here! Alexander Turcic Announcements 3 03-01-2004 08:53 AM


All times are GMT -4. The time now is 07:13 PM.


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