Skip to content Skip to sidebar Skip to footer

Using Cookie With Request

I am trying to send cookie with URL for request. But I am getting no output. The code: header ={('cookies','ecrZipInput=55401')} response = requests.get('www.url.com', cookie=heade

Solution 1:

You can try this way instead :

response = requests.get('www.url.com', cookies={'ecrZipInput':'55401'})
soup = BeautifulSoup(response.text)

Notice that the parameter name is plural 'cookies' and it accepts dictionary value.

[See : Requests Quickstart > Cookies]

Post a Comment for "Using Cookie With Request"