Search
 
SCRIPT & CODE EXAMPLE
 

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))
Comment

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))
Comment

PREVIOUS NEXT
Code Example
Python :: The float type in Python3 can represent decimal 0.1 without error. 
Python :: how to package a python library 
Python :: get out of a help screen python 
Python :: how to install apps in django 
Python :: palindrome program in python 
Python :: logged_passengers 
Python :: python yield async await thread function 
Python :: Membership in a list 
Python :: how to clear formatting in python 
Python :: how to get total seconds in django queryset for timedelta field 
Python :: pyhton transpose without changing column and row names 
Python :: 3x4 matrix 
Python :: Creating column based on existing column 
Python :: geopandas bbox 
Python :: calculating expressions with sqrt signs 
Python :: Python create time slot within duration 
Python :: python using boolean len comparing with 
Python :: how to reorder columns in pandas 
Python :: Django forms I cannot save picture file 
Python :: how to change pi hostname in python file 
Python :: python bill 
Python :: The module in NAME could not be imported: django.contrib.user_auth.password_validation.UserAttributeSimilarityValidator. Check your AUTH_PASSWORD_VALI 
Python :: How many handshakes for all the people in your class? python code 
Python :: python code to display a grid of data table 
Python :: plt.plot(x, softmax(scores).T, linewidth=2) 
Python :: xml to sqlite 
Python :: Python Importing module from a package 
Python :: osmapi 
Python :: kivy window location 
Python :: fetchall in python sqilite3 
ADD CONTENT
Topic
Content
Source link
Name
8+6 =