I have an actual challenge with my API, it runs well on Pythonanywhere side, but the only challenge is when I am making requests to get response. I ended up using the default script to from Pythonanywhere to see if I will get the 'OK' status, but I failed also, please help.
I was trying to get response from a shared hosting server that I have python pip installed.
I can't seem to get even this default script running, please help with any suggestion.
`username = 'zett'
token = '************'
response = requests.get(
'https://www.pythonanywhere.com/api/v0/user/{username}/cpu/'.format(
username=username
),
headers={'Authorization': 'Token {token}'.format(token=token)}
)
if response.status_code == 200:
print('ALL IS OK!:')
else:
print('Got unexpected status code {}: {!r}'.format(response.status_code, response.content))
`