import requests
username = '<username>'
token = '<your_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('CPU quota info:')
print(response.content)
else:
print('Got unexpected status code {}: {!r}'.format(response.status_code, response.content))
import requests
username = 'your username'
token = 'your token'
host = 'your host'
response = requests.get(
'https://{host}/api/v0/user/{username}/cpu/'.format(
host=host, username=username
),
headers={'Authorization': 'Token {token}'.format(token=token)}
)
if response.status_code == 200:
print('CPU quota info:')
print(response.content)
else:
print('Got unexpected status code {}: {!r}'.format(response.status_code, response.content))