except Exceeded 30 redirects if [] in url

Viewed 74

I want sent requests on URL "https://example.com//?parameter[]=" but u get requests.exceptions.TooManyRedirects: Exceeded 30 redirects. if I remove '[]' from URL I get a response, but not the response (200 status code) I need. All requests send with headers from browser.

r = session.get("https://example.com/*/?parameter[]=*", headers=headers, allow_redirects=False)

doesn't help me

1 Answers

I guess to avoid this you should try this:

try:
    r = session.get("https://host.com/*/?parameter[]=*", headers=headers, allow_redirects=False)
    print(r.status_code)
except requests.exceptions.TooManyRedirects:
    pass
Related