Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

pythonanywhere API example

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))
Source by www.pythonanywhere.com #
 
PREVIOUS NEXT
Tagged: #pythonanywhere #API
ADD COMMENT
Topic
Name
2+1 =