4
I want to file a requisition GET
for a particular URL, but I want to send cookie data, as a web browser does.
For example, in the code below:
from urllib import request
req = request.Request('http://servidor/pagina.html')
response = request.urlopen(req)
print(response.read().decode())
If I print the headers, the result is an empty list:
print(req.header_items())
But I want to send a header HTTP
like this:
Cookie: atributo=valor+do+atributo
Part of the question for anyone already experienced with Python:
I’m in the Level 17 pythonchallenge.com and need to make a request by sending an "info" cookie with the value "the+Flowers+are+on+their+way" to the url http://www.pythonchallenge.com/pc/stuff/violin.php.
Maicon, this really might be a solution. But this library does not come with Python and at this point I wanted to avoid the use and installation of external libraries. Hug.
– utluiz
Got it, thanks for the warning.
– Maicon Carraro