Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to access PythonAnywhere CPU Allowance from a script?

I'm curious how my CPU allowance on PythonAnywhere is trending over several days. Is there a way to access this value from a script such that I can setup a Schedule task to take readings once an hour and save them?

like image 304
TimothySwieter Avatar asked Apr 10 '14 03:04

TimothySwieter


1 Answers

PythonAnywhere dev here: There isn't, unfortunately, but that's a great suggestion! I'll add it to our list.

Update

And here is new (2019-09-11) API endpoint:

/api/v0/user/{username}/cpu/

GET Returns information about cpu usage in json format:

{
    "daily_cpu_limit_seconds": <int>,
    "next_reset_time": <isoformat>,
    "daily_cpu_total_usage_seconds": <float>
}

see the blog post with example of usage.

like image 54
Giles Thomas Avatar answered Sep 29 '22 00:09

Giles Thomas