'httpx python request to webpage wont redirect

Currently making a request to a webpage which redirects a user to another URL (after a few seconds) but my httpx request doesn't follow this redirect, it just stops after it has made the request to the original URL. I am using the follow redirects kwarg, which statesd that it should be redirected, but this doesn't work. print(request) outputs none.

I'm unsure how I can fix this?

import httpx
client = httpx.Client(follow_redirects=True)
request = client.build_request("GET", "example...")
while request is not None:
    response = client.send(request)
    request = response.next_request
    print(request)


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source