What is the easiest way to check whether the response received from a requests post was "200 OK" or an error has occurred?
I tried doing something like this:
....
resp = requests.post(my_endpoint_var, headers=header_var, data=post_data_var)
print(resp)
if resp == "<Response [200]>":
print ('OK!')
else:
print ('Boo!')
The output on the screen is:
Response [200] (including the "<" and ">")
Boo!
So even though I am getting a 200, my check in the if statement is somehow not matching?