项目作者: mahmoudadel2

项目描述 :
Simple Python webservice to provide the latest statistics about Coronavirus COVID-19 in JSON format.
高级语言: Python
项目地址: git://github.com/mahmoudadel2/covid19-webservice.git
创建时间: 2020-03-08T06:17:47Z
项目社区:https://github.com/mahmoudadel2/covid19-webservice

开源协议:MIT License

下载


covid19-webservice

Simple Python webservice to provide the latest statistics about Coronavirus COVID-19 in JSON format.

Running local/dev

Prerequisites

  1. pip install -r requirements.txt

Start the webservice

  1. python -m covid19_webservice

Running on production

Build an image

  1. docker build -t covid19-webservice .

Run the container

  1. docker run -d --name covid19-webservice -p 8080:8080 covid19-webservice

Usage

I’ve listed the available endpoints in the webservice home page, e.g. http://localhost:8080/

Examples

Getting a country by name (German):

  1. curl http://localhost:8080/get/country/name/Ägypten
  2. {
  3. "confirmed": 49,
  4. "deaths": 1,
  5. "lat": 26.0,
  6. "lon": 30.0,
  7. "recovered": 1,
  8. "updated": "2020-03-08 19:03:11"
  9. }

Getting a city by name (German):

  1. curl http://localhost:8080/get/city/name/Deutschland/Bayern
  2. {
  3. "confirmed": 200,
  4. "deaths": 0,
  5. "lat": 48.768814,
  6. "lon": 11.658164999999999,
  7. "recovered": 14,
  8. "updated": "2020-03-08 17:00:00"
  9. }