Forums

Using PA as json file hosting?

Greetings,

I'm planning to use Python to generate a json file and frequently update it as much as every 5-10 seconds. Then I'll have my mobile app to send request to this json file.

My question: what's the limit of request PA would allow? Would it be same as the limit of PA Plans? 100K hit/day for Hacker, and so on?

Or PA doesn't allow to do such thing?

Thank you very much,

Sure you can do that, if you want. The number of requests that your site can handle will be heavily dependant on your code and configuration: https://help.pythonanywhere.com/pages/HowManyHitsCanMySiteHandle/ If you're only serving your json file as a static file and your web app does nothing else, that will be the fastest possible.

Yes, it's just a simple Python file to generate a json file and place it at /static/ folder and have Always On Task running it. You can see the json output here: https://alanluong66.pythonanywhere.com/static/stockdata.json

Everything works as expected beside my json file seems to be updated less frequently than I expected. How often Always On Task execute a file once it's on Running stage? I tried to time it before approximately every 5 minutes I guess?

Thank you very much,

It will updated it as quickly as your code does unless you have sleeps in your code. If you have sleeps in your code it will update every <sleep time> + <how long your code takes to execute>

Great, finally got it working the way I wanted. It was just a misunderstand of what Always On Task is :)