In [1]:
import requests
In [2]:
url = 'https://en.wikipedia.org'
In [3]:
r = requests.get(url)
In [4]:
print(r.url)
In [5]:
print(r.status_code)
In [6]:
print(r.history)
In [7]:
print(len(r.history))
In [8]:
print(type(r.history[0]))
In [9]:
print(r.history[0].url)
In [10]:
print(r.history[0].status_code)
In [11]:
print([response.url for response in r.history])
In [12]:
r_not_redirect = requests.get(url, allow_redirects=False)
In [13]:
print(r_not_redirect.url)
In [14]:
print(r_not_redirect.status_code)