Skip to main content

A python wrapper for the pythonanywhere.com API

Project description

MyPythonAnywhere

A python package to communicate with PythonAnywhere api.

Installation

The beta package is available at PyPi.

Get Started

Requirements

  1. Api Token: get your api token from pythonanywhere account page.

  2. Determine if your account is US_Based or EU_Based ( It's commonly US. )

  3. Your username.

Create Client

from mypythonanywhere import PythonAnywhereClient, AccountType

client = PythonAnywhereClient(
    username='MerrilleChoate',
    token='API_TOKEN',
    account_type=AccountType.UsBased
)

Send Requests

Get cpu usage.

>>> result = client.cpu.get_cpu_usage()
>>> print(result)
# CpuUsage(daily_cpu_limit_seconds=100, next_reset_time='2022-04-17T11:23:40', daily_cpu_total_usage_seconds=0.0) 

Get all of your consoles.

>>> result = client.consoles.get_consoles()
>>> print(result)
# [Console(id=24036640, user='MerrilleChoate', executable='python2.7', arguments='', working_directory=None, name='Python2.7 console 24036640', console_url='/user/MerrilleChoate/consoles/24036640/', console_frame_url='/user/MerrilleChoate/consoles/24036640/frame/')]

Direct Call

from mypythonanywhere.types.requests.console_requests import GetConsoleInfo

# --- sniff ---

console = client(GetConsoleInfo(123456789)) # Console

🍟 Not all methods are implemented yet! ...

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mypythonanywhere-0.0.7rc0.tar.gz (8.4 kB view hashes)

Uploaded Source

Built Distribution

mypythonanywhere-0.0.7rc0-py3-none-any.whl (12.5 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page