File tree Expand file tree Collapse file tree 3 files changed +23
-1
lines changed
Expand file tree Collapse file tree 3 files changed +23
-1
lines changed Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ Programming Interface
88
99 base
1010 files
11+ resources
1112 schedule
1213 students
1314 webapp
Original file line number Diff line number Diff line change 1+ Resources
2+ =========
3+
4+ .. automodule :: resources
5+ :members:
Original file line number Diff line number Diff line change 55
66
77class CPU :
8+ """Interface for PythonAnywhere CPU resources API.
9+
10+ Uses `pythonanywhere_core.base` :method: `get_api_endpoint` to
11+ create url, which is stored in a class variable `CPU.base_url`,
12+ then calls `call_api` with appropriate arguments to execute CPU
13+ resource actions.
14+
15+ Methods:
16+ - :meth:`CPU.get_cpu_usage`: Get current CPU usage information.
17+ """
18+
819 def __init__ (self ):
920 self .base_url = get_api_endpoint (username = getpass .getuser (), flavor = "cpu" )
1021
1122 def get_cpu_usage (self ):
12- """Get current CPU usage information."""
23+ """Get current CPU usage information.
24+
25+ :returns: dictionary with CPU usage information including daily limit,
26+ total usage, and next reset time
27+ :raises PythonAnywhereApiException: if API call fails
28+ """
1329 response = call_api (url = self .base_url , method = "GET" )
1430 if not response .ok :
1531 raise PythonAnywhereApiException (f"GET to { self .base_url } failed, got { response } :{ response .text } " )
You can’t perform that action at this time.
0 commit comments