Различные значения между датчиками TYPE_ACCELEROMETER / TYPE_MAGNETIC_FIELD и TYPE_ORIENTATION

Вы ищете историю запросов .

Атрибут response.history - это список ответов, которые привели к окончательному URL-адресу, который можно найти в response.url .

response = requests.get(someurl)
if response.history:
    print "Request was redirected"
    for resp in response.history:
        print resp.status_code, resp.url
    print "Final destination:"
    print response.status_code, response.url
else:
    print "Request was not redirected"

Демонстрация:

>>> import requests
>>> response = requests.get('http://httpbin.org/redirect/3')
>>> response.history
(, , )
>>> for resp in response.history:
...     print resp.status_code, resp.url
... 
302 http://httpbin.org/redirect/3
302 http://httpbin.org/redirect/2
302 http://httpbin.org/redirect/1
>>> print response.status_code, response.url
200 http://httpbin.org/get

14
задан Gabriel Llamas 13 November 2010 в 19:55
поделиться