{"id":20982242,"url":"https://github.com/immmdreza/mypythonanywhere","last_synced_at":"2025-12-26T08:21:32.648Z","repository":{"id":41972439,"uuid":"481944810","full_name":"immmdreza/mypythonanywhere","owner":"immmdreza","description":"A python wrapper over PythonAnywhere API.","archived":false,"fork":false,"pushed_at":"2022-04-21T12:04:53.000Z","size":107,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-20T09:27:35.707Z","etag":null,"topics":["api","api-wrapper","python","pythonanywhere"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/immmdreza.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-04-15T12:02:06.000Z","updated_at":"2022-04-19T13:07:18.000Z","dependencies_parsed_at":"2022-08-12T01:01:06.526Z","dependency_job_id":null,"html_url":"https://github.com/immmdreza/mypythonanywhere","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/immmdreza%2Fmypythonanywhere","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/immmdreza%2Fmypythonanywhere/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/immmdreza%2Fmypythonanywhere/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/immmdreza%2Fmypythonanywhere/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/immmdreza","download_url":"https://codeload.github.com/immmdreza/mypythonanywhere/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243384823,"owners_count":20282441,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","api-wrapper","python","pythonanywhere"],"created_at":"2024-11-19T05:44:57.128Z","updated_at":"2025-12-26T08:21:27.622Z","avatar_url":"https://github.com/immmdreza.png","language":"Python","readme":"# MyPythonAnywhere\n\nA python async package to communicate with [PythonAnywhere](https://help.pythonanywhere.com/pages/API) api.\n\n## Installation\n\nThe beta package is available at [PyPi](https://pypi.org/project/mypythonanywhere).\n\n## Get Started\n\n### Requirements\n\n1. Api Token: get your api token from [pythonanywhere account page](https://www.pythonanywhere.com/user/MerrilleChoate/account/).\n\n2. Determine if your account is US_Based or EU_Based ( It's commonly US. )\n\n3. Your username.\n\n### Create Client\n\n``` py\nfrom mypythonanywhere import AccountType, FriendlyPythonAnywhereClient\n\nclient = FriendlyPythonAnywhereClient(\n    username='MerrilleChoate',\n    token='API_TOKEN',\n    account_type=AccountType.UsBased\n)\n```\n\n### Send Requests\n\nGet cpu usage.\n\n``` py\n\u003e\u003e\u003e result = await client.cpu.get_cpu_usage()\n\u003e\u003e\u003e print(result)\n# CpuUsage(daily_cpu_limit_seconds=100, next_reset_time='2022-04-17T11:23:40', daily_cpu_total_usage_seconds=0.0) \n```\n\nGet all of your consoles.\n\n``` py\n\u003e\u003e\u003e result = await client.consoles.get_consoles()\n\u003e\u003e\u003e print(result)\n# [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/')]\n```\n\n### A full example\n\nSend requests one by one\n\n``` py\nimport asyncio\n\nasync def main():\n\n    client = FriendlyPythonAnywhereClient(\n        username='MerrilleChoate',\n        token='API_TOKEN',\n        account_type=AccountType.UsBased\n    )\n\n    consoles = await client.console.get_consoles()\n    print(consoles)\n\nloop = asyncio.get_event_loop()\nloop.run_until_complete(main())\n```\n\nSend a batch of requests using one session\n\n``` py\nimport asyncio\n\nasync def main():\n\n    client = FriendlyPythonAnywhereClient(\n        username='MerrilleChoate',\n        token='API_TOKEN',\n        account_type=AccountType.UsBased\n    )\n\n    async with client:\n        consoles = await client.console.get_consoles()\n        for x in consoles:\n            await client.console.kill_console(x.id)\n\nloop = asyncio.get_event_loop()\nloop.run_until_complete(main())\n```\n\n### Direct Call\n\n``` py\nfrom mypythonanywhere.pythonanywhere import PythonAnywhereClient\nfrom mypythonanywhere.types.requests.console_requests import GetConsoleInfo\n\nclient = PythonAnywhereClient(\n    # --- sniff ---\n)\n\nconsole = await client(GetConsoleInfo(123456789)) # Console\n```\n\n🍟 _Not all methods are implemented yet!_\n...\n\n## Contribute\n\nThere're api methods that are not implemented. following the order of \u003chttps://help.pythonanywhere.com/pages/API\u003e, methods related to files and below are yet to implement.\n\n### Implement Methods?\n\nTake a look at [requests dir](src/mypythonanywhere/types/requests) for examples of implementing api methods.\n\nAll you need is to inherit from `BaseRequest[T]` ( where `T` is the method return type ). then filling the abstract methods, unless you face something new.\n\n### Automated tests\n\nTests are missing for most of methods.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fimmmdreza%2Fmypythonanywhere","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fimmmdreza%2Fmypythonanywhere","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fimmmdreza%2Fmypythonanywhere/lists"}