I have a rest api which return True, False and "". Which i receive this in my requests.content I get the type as byte. I convert them to string and then try to compare. But the last else block executes leaving behind the first and second.
import requests
headers = {'Accept': '*/*'}
response = requests.get('http://{IP}/status', headers=headers)
status = response.content
status = str(status)
print(status)
# status returns "True", "False", ""
if (status == "True"):
print ('Admin approved this request')
elif (status == "False"):
print ('Admin disapproved this request')
else:
print ('No response from admin')
Getting :- 'No response from admin' In all the cases