Base
- base.call_api(url: str, method: str, **kwargs) Response[source]
Calls PythonAnywhere API with given url and method.
- Parameters:
url – url to call
method – HTTP method to use
kwargs – additional keyword arguments to pass to requests.request
- Returns:
requests.Response object
- Raises:
AuthenticationError – if API returns 401
NoTokenError – if API_TOKEN environment variable is not set
Client identification can be provided via PYTHONANYWHERE_CLIENT environment variable (e.g., “pa/1.0.0” or “mcp-server/0.5.0”) to help with usage analytics.
- base.get_username() str[source]
Returns PythonAnywhere username from
PYTHONANYWHERE_USERNAMEenvironment variable, falling back togetpass.getuser().