Parth Tilokani
Parth Tilokani

Reputation: 21

Getting 200 in response instead of 302

I am trying to post multipart/form data using requests library according to website on submiting the form you are redirected to page where your data is created but when I am trying using requests library it gives 200 as response instead it should give 302 as response please could any one help me in this i dont know what i am doing wrong

Upvotes: 2

Views: 1816

Answers (1)

Joe Halliwell
Joe Halliwell

Reputation: 1177

By default requests will follow "302" redirection responses. You can disable this as follows:

r = requests.get('http://github.com/', allow_redirects=False)

See https://requests.kennethreitz.org/en/master/user/quickstart/#redirection-and-history

Upvotes: 4

Related Questions