Hi Justin, The cookie which I am getting in the code is not reflecting in server side : i.e if it generate cookie : x then its not visible in server where I am sending my request. Does python request behave like curl command?
On Tuesday, 5 November 2013 15:33:22 UTC+5:30, Justin Israel wrote: > > This is an absolute shot in the dark... but, does it have anything to do > with possibly lacking a session in your http requests? > The python "requests" module supports sessions: > http://www.python-requests.org/en/latest/user/advanced/#session-objects > > Is that what you are looking for? Is the problem that you are not seeing > the cookies persist? > > > On Tue, Nov 5, 2013 at 9:40 PM, Reetesh Nigam > <[email protected]<javascript:> > > wrote: > >> Hi All, >> >> I need to read cookie using Python api. I have tried below library: >> 1. webdriver of selenium >> 2. urllib2 >> 3. cookie jar. >> >> for all the above library I am getting different cookie id if I fire same >> URL using above code. >> >> Note : If I use browser and fire same command I get same cookie id. below >> are the code.. >> >> from selenium import webdriver >> driver = webdriver.Firefox() >> >> driver.get("abc.com") >> >> cookies = driver.get_cookies() >> for cookie in cookies: >> print(cookie['name'] + ' --> ' + cookie['value']) >> print cookie['domain'] >> print cookie['expiry'] >> print cookie['path'] >> print "*=*"*10 >> >> ============================ >> >> from urllib2 import Request, build_opener, HTTPCookieProcessor, >> HTTPHandler >> import cookielib >> cj = cookielib.CookieJar() >> opener = build_opener(HTTPCookieProcessor(cj), HTTPHandler()) >> req = Request("abc.com") >> f = opener.open(req) >> print "the cookies are: " >> for cookie in cj: >> print cookie >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Python Programming for Autodesk Maya" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected] <javascript:>. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/python_inside_maya/2ddd33ff-eb91-49c4-bd0b-4e463049f6b3%40googlegroups.com >> . >> For more options, visit https://groups.google.com/groups/opt_out. >> > > -- You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/3498360a-97c8-4356-a2f1-1b715f7c10d8%40googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
