In [1]:
import requests

In [2]:
url = 'https://en.wikipedia.org'

In [3]:
r = requests.get(url)

In [4]:
print(r.url)


https://en.wikipedia.org/wiki/Main_Page

In [5]:
print(r.status_code)


200

In [6]:
print(r.history)


[<Response [301]>]

In [7]:
print(len(r.history))


1

In [8]:
print(type(r.history[0]))


<class 'requests.models.Response'>

In [9]:
print(r.history[0].url)


https://en.wikipedia.org/

In [10]:
print(r.history[0].status_code)


301

In [11]:
print([response.url for response in r.history])


['https://en.wikipedia.org/']

In [12]:
r_not_redirect = requests.get(url, allow_redirects=False)

In [13]:
print(r_not_redirect.url)


https://en.wikipedia.org/

In [14]:
print(r_not_redirect.status_code)


301