Home

Published

- 1 min read

python requests header allow redirect false

img of python requests header allow redirect false

The solution for this is noted below

python requests header allow redirect false

Solution

   import requests
url = "http://mock.kite.com/redirect"
print requests.get(url, allow_redirects = False).text
OUTPUT
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<title>Redirecting...</title>
<h1>Redirecting...</h1>
<p>You should be redirected automatically to target URL: <a href="/text">/text</a>.  If not click the link.

Try other methods by searching on the site. That is if this doesn’t work