Skip to content
Cecilia Wong edited this page May 1, 2024 · 22 revisions

Environments

Environment Base URL Remark(s)
Local development/testing http://localhost:5000/
On Render https://python-webservice-demo.onrender.com - Runs the version at master branch.
- Using the free tier.
- Sleeps after the webservice has been idle for 15 minutes. Startup (cold start) is triggered when an endpoint is called in this case, which may take around 30-50 seconds.
This problem is now mitigated by keep-alive mechanism using UptimeRobot with the /healthcheck endpoint.
On Azure https://python-ws-demo.azurewebsites.net/ - Runs the version at master branch.
- Using the free tier. CPU time limited to 60 minutes/day, and service will become unavailable for the day when the quota is used up.
Unloads after some time of inactivity, apparently 20 minutes; may take more than one minute to bring it back up after that.

Tip

To healthcheck the webservice, ping the webservice with the /healthcheck endpoint.
eg. Using Curl:

curl --head '<Base URL of environment>/healthcheck'

You may also access the API documentation page of the instance:

<Base URL of environment>/api/doc

These may also be used for "waking up" an instance that has gone to sleep as mentioned above.

Endpoints

The full API documentation is hosted at this repository's Pages.

  • API calls by the "Try it out" feature are made to the Render instance.

Local copy of API documentation for testing your local webservice instance: http://localhost:5000/api/doc

Endpoint HTTP Method Description
/ GET Prints "Hello World!".
/greeting/{name} GET Prints a personalized greeting with the name provided by {name}.
/timestwo POST Multiplies a number by 2.
/getWorkers POST Retrieves a list of workers configured in a backend JSON file.
/calculateDate POST Calculates a specified number of weeks before/after a given date.
/getSumoHonbashoSchedule GET Determines the Grand Sumo Tournament schedule for a given year.
/healthcheck GET/HEAD May be used to implement healthcheck mechanism.

Docker images

At Docker Hub: https://hub.docker.com/r/ccwong4869/python-webservice-demo
See the Overview section for the list of Docker images (tags).

Enhancement(s) planned for next release

(TBC)