Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

pythonanywhere api

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))
Source by help.pythonanywhere.com #
 
PREVIOUS NEXT
Tagged: #pythonanywhere #api
ADD COMMENT
Topic
Name
8+5 =