Getting Started¶
When you first download the repo, there are four python files included:
test.py
miami_api.py
server.py
html_functions.py
test.pysimply informs you if you have the required modules installed. When run, this will either give instructions on how to install the Tornado web framework, or inform the user that the requirement is already met.miami_api.pyholds the functions that are used for the API calls by the web server. This can also be used by itself as an API independent of the server. This file will not do anything if run.server.pyholds the logic for the web server that hosts the RESTful API and the dynamic homepage. When run, this will not show any output, and will just begin hosting a server on port5000.html_functions.pyholds some functions that make the HTML templates cleaner. Tried to keep as much logic as possible out of them. This file will not do anything if run.
Python API¶
There are three main API calls that this provides:
RESTful API¶
Running the server.py file will start an instance of the Tornado web
server. It will host a dynamic web page, and will also return JSON data for
calls to the above functions. The address for each of these services is:
[server_address]:5000for the dynamic homepage[server_address]:5000/api/openfor a call to theget_open()function[server_address]:5000/api/status/[location]for a call to theget_status()function with[location]as the argument[server_address]:5000/api/todayfor a call to theget_today_hours()function[server_address]:5000/api/person/[name]for a call to theget_person_info()function with[name]as the argument