egbakou
coronavirus-tg-api
Python

API for tracking the global coronavirus (COVID-19, SARS-CoV-2) ๐Ÿฆ  outbreak in Togo. It's written in python using the FastAPI framework ๐Ÿ”ฅ. Supports government source!

Last updated Apr 29, 2026
99
Stars
4
Forks
9
Issues
0
Stars/day
Attention Score
4
Language breakdown
Python 83.5%
Shell 11.3%
Dockerfile 3.2%
Makefile 2.0%
โ–ธ Files click to expand
README

Coronavirus Tg API

Provides up-to-date data about Coronavirus outbreak in Togo. Includes numbers about confirmed cases, deaths and recovered. Support unique government source.

Travis build License GitHub stars GitHub forks GitHub last commit GitHub pull requests GitHub issues Code style: black Tweet

Available data-sources:

Currently 1 data-source is available to retrieve the data:

  • Togolese Government dedicated website for the covid19 - https://covid19.gouv.tg

API Reference

All endpoints are located at `coronavirus-tg-api.herokuapp.com/v1/ and are accessible via https.

You can open the URL in your browser to further inspect the response. Or you can make this curl call in your terminal to see the prettified response:

<pre><code class="lang-">curl https://coronavirus-tg-api.herokuapp.com/v1/cases | json_pp</code></pre>

Swagger/OpenAPI

Consume our API through our super awesome and interactive SwaggerUI (on mobile, use the mobile friendly ReDocs instead for the best experience).

The OpenAPI json definition can be downloaded at https://coronavirus-tg-api.herokuapp.com/openapi.json

Technologies used for the project

  • Python3.8 / FastApi / Unicorn / => Language & Framework
  • Docker & Docker Compose => Dockerization
  • Heroku => Hosting
  • Travis => Build,Test, deploy, โ€ฆ (Github Actions soon)
  • Telegram API => Bot to receive Travis job result instead of email notification

API Endpoints

Cases Endpoint

Getting total of confirmed cases, deaths, recovered and the last updated date.

<pre><code class="lang-http">GET /v1/cases</code></pre>

Sample response <pre><code class="lang-json">{ &quot;confirmed&quot;: 99, &quot;recovered&quot;: 62, &quot;deaths&quot;: 6, &quot;last_updated&quot;: &quot;2020-04-27 11:12:00&quot; }</code></pre>

Sources Endpoint

Getting the data-sources that are currently available to Coronavirus Tg API to retrieve the data of the pandemic. Currently,the government website and the tracker api project.

<pre><code class="lang-http">GET /v1/sources</code></pre>

Sample response <pre><code class="lang-json">{ &quot;government_website&quot;: &quot;https://covid19.gouv.tg&quot;, &quot;trackerapiproject&quot;: &quot;https://github.com/egbakou/coronavirus-tg-api&quot; }</code></pre>

Confirmed cases Endpoint

Getting confirmed cases data.

<pre><code class="lang-http">GET /v1/cases/confirmed</code></pre>

Sample response

<pre><code class="lang-json">{ &quot;confirmed&quot;: 99, &quot;last_updated&quot;: &quot;2020-04-27 11:12:00&quot; }</code></pre>

Recovered cases Endpoint

Getting recovered cases data.

<pre><code class="lang-http">GET /v1/cases/recovered</code></pre>

Sample response

<pre><code class="lang-json">{ &quot;recovered&quot;: 62, &quot;last_updated&quot;: &quot;2020-04-27 11:12:00&quot; }</code></pre>

Deaths data Endpoint

Getting number of deaths.

<pre><code class="lang-http">GET /v1/cases/deaths</code></pre>

Sample response

<pre><code class="lang-json">{ &quot;deaths&quot;: 6, &quot;last_updated&quot;: &quot;2020-04-27 11:12:00&quot; }</code></pre>

Response definitions

| Response Item | Description | Type | | ----------------- | ------------------------------------------------------------ | -------- | | {cases} | total of confirmed cases, deaths, recovered and the last updated date. | Object | | {cases}/confirmed | The up-to-date total number of confirmed cases | Integer | | {cases}/deaths | The up-to-date total number of deaths | Integer | | {cases}/recovered | The up-to-date total number of recovered | Integer | | {sources} | Data-sources used to provide data | Object |

> We strongly recommend using the endpoint /v1/cases instead of using the endpoints returning each case.

Wrappers

No wrapper at the moment.

Prerequisites

You will need the following things properly installed on your computer.

Installation

  • git clone https://github.com/egbakou/coronavirus-tg-api.git
  • cd coronavirus-tg-api
* with pipx $ pipx install pipenv * with Homebrew/Linuxbrew $ brew install pipenv * with pip/pip3 directly $ pip install --user pipenv
  • Create virtual environment and install all dependencies $ pipenv sync --dev
  • Activate/enter the virtual environment $ pipenv shell
And don't despair if don't get the python setup working on the first try. No one did. Guido got pretty close... once. But that's another story. Good luck.

Running / Development

For a live reloading on code changes.

  • pipenv run dev
Without live reloading.
  • pipenv run start
Visit your app at http://localhost:8000.

Alternatively run our API with Docker.

Running Tests

> pytest

<pre><code class="lang-bash">pipenv run test</code></pre>

Linting

> pylint

<pre><code class="lang-bash">pipenv run lint</code></pre>

Formatting

> black

<pre><code class="lang-bash">pipenv run fmt</code></pre>

Update requirements files

<pre><code class="lang-bash">invoke generate-reqs</code></pre>

Pipfile.lock will be automatically updated during pipenv install.

Docker

Our Docker image is based on tiangolo/uvicorn-gunicorn-fastapi/.

<pre><code class="lang-bash">invoke docker --build</code></pre>

Run with docker run or docker-compose

Alternate Docker images

If a full gunicorn deployment is unnecessary or impractical on your hardware consider using our single instance Uvicorn based Dockerfile.

Invoke

Additional developer commands can be run by calling them with the python invoke` task runner.

invoke --list

Deploying

Created by: Kodjo Laurent Egbakou

Contribution

Feel free to create issues and PRs :)

ยฉ 2026 GitRepoTrend ยท egbakou/coronavirus-tg-api ยท Updated daily from GitHub