Reputation: 3845
For the link : http://www.ibnlive.com/videos/world/
by using a web browser I can easily see the following cookies when page is loaded as shown :
But if I try to load the same cookies using python requests, it shows up as an empty dictionary :
import requests
s = requests.session()
connection = s.get('http://www.ibnlive.com/videos/world/')
print(s.cookies) # produces an empty dictionary
My question how can I get those cookies using a python script ?
Upvotes: 1
Views: 981
Reputation: 5173
Because the cookie is not being set by http://www.ibnlive.com/videos/world/
, but some other resource that the page is loading. Try looking at the headers for that url, you won't see any Set-Cookie
headers.
Upvotes: 1