I wrote a small desktop application (python 2.7, tkinter) that uses an API key that I'm meant to keep secure - i.e. not keep it in the source python files. The method that was recommended was to have the app send a request to a webserver (I'm going to use pythonanywhere), tack on the API key (with the relevant URL), which would return JSON data to the app (via the server of course). I imagine one can do this without using Django/Flask/etc., and it seemed something in the BaseHTTP... modules would help. However, I am completely new to web programming, so there is a lot I don't understand. Some things I would like help with are:
If I put some random code in my main site folder (say /somefile.py), does a request to http://www.example.com/ automatically run somefile.py? This seems unlikely, where can I read up on this? Do my files need special names? Or just references? to them
Do I even need an actual "visitable" page?
In sum, can someone point me to documentation of the necessary steps for the abovementioned problem, or even some available solution that I may have overlooked in my searches? I have seen examples of BaseHTTPserver run locally, but I'm not sure how I'd get one to work online in a pythonanywhere-type environment.
Examples:
http://www.acmesystems.it/python_httpserver
http://effbot.org/librarybook/simplehttpserver.htm
Regarding ports, this might be relevant: Using PythonAnywhere as a game server
And, I just found this: http://pythonpaste.org/do-it-yourself-framework.html
For anyone who wants a full example (if the above was not clear enough): Someone may want to check data for a profile "Profile". My app will send a request like
(or just http://mypage.pythonanywhere.com/stats-by-summoner/Profile/ranked?season=SEASON4 with the other stuff added in a modified BaseHTTPrequesthandler class), which will turn it into:
http://mypage.pythonanywhere.com/https://euw.api.pvp.net/api/lol/euw/v1.3/stats/by-summoner/Profile/ranked?season=SEASON4& api_key=my_api_key_here