Http.Request and cookies Python

Posted by Kyle on Stack Overflow See other posts from Stack Overflow or by Kyle
Published on 2012-08-28T19:33:11Z Indexed on 2012/08/28 21:38 UTC
Read the original article Hit count: 192

Filed under:
|
|
|

I am trying to retrieve source code from a webpage with an already issued cookie and write the source code to a txt file. If I remove the cookies=cookie portion I can retrieve the source code but I need to somehow send the cookie with the http.request.

output = open('Filler.txt', 'w+')
http = urllib3.PoolManager()
cookie =('users' , '1597413515')
r = http.request('http://google.com' , 'GET' , cookies=cookie)
output.write(r.data)
output.close()

I get a KeyError: None

© Stack Overflow or respective owner

Related posts about python

Related posts about http