Resolved: Python requests stop redirects does not work

In this post, we will see how to resolve Python requests stop redirects does not work

Question:

I want to access the content of a web page, but I’m being redirected to another page even though I’ve set allow_redirects to False in my requests call. Here’s an example code snippet:
When I run this code, I don’t get any content from the web page. However, if I set allow_redirects to True, I’m redirected to this URL: Convert between byte count and “human-readable” string.

Best Answer:

You’d have to log in to get to the original SO question because

anonymous users get automatically redirected to the duplicate target when trying to access questions closed as duplicates with no answers


The relevant Meta Post, which is a duplicate itself of this question.
You can replicate this switching to Private Mode in your browser and then opening this link:
Program is about space utilisation. i am getting error : 72G value too great for base (error token is “72”)
You should get redirected to Convert between byte count and “human-readable” string
EDIT:
You can turn off this behaviour and get to the original post with rquests by appending the URL with:
Here’s an example:
Output:

If you have better answer, please add a comment about this, thank you!

Source: Stackoverflow.com