Skip to content

πŸ“œ covid19api.com Python API client (historical archive)

License

Notifications You must be signed in to change notification settings

Am-I-Going-On-Holiday/Tourist

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

5 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Tourist

Python API client for the (now defunct) covid19api.com service.

Archival

This project is no longer maintained. The API it was built for is no longer available. The main intention of Tourist was to refactor the existing covid19api.com API client hosted on 'Am I Going On Holiday?' to make it more maintainable and easier to extend.

However, the API service announced its deprecation in late April 2023. As such, this project is no longer maintained and is archived.

A copy of all the JSON responses from the API is available in the archive directory.

Usage

To use Tourist, you will require a valid premium subscription to the covid19api.com service.

After, you can include your API key in the client by modifying the access_token variable in src/client.py.

Examples

Get country cases and deaths

Retrieve the latest COVID-19 statistics for a given country within a given date range.

from tourist import Tourist

client = Tourist()

# Cases
print(client.get_total_cases('Switzerland', '2020-01-01', '2020-03-31'))
>>> 17909

# Deaths
print(client.get_total_deaths('Switzerland', '2020-01-01', '2020-03-31'))
>>> 438

Get border restrictions

Retrieve the latest border restrictions for a given country.

from tourist import Tourist

client = Tourist()

restrictions = client.get_travel_restrictions('France')

# Restriction level code (0-4)
print(restrictions['restrictions_level'])
>>> 3

# Restriction level description
print(restrictions['restrictions_description'])
>>> "Level 3: Ban arrivals from some regions"

Get global totals

Retrieve the latest global case and death totals.

from tourist import Tourist

client = Tourist()

global_totals = client.get_global_totals()

# Global cases (new and total since the start of pandemic)
print(global_totals['total_new_cases'])
>>> 177325
print(global_totals['total_cases'])
>>> 674300711

# Global deaths (new and total since the start of pandemic)
print(global_totals['total_new_deaths'])
>>> 1319
print(global_totals['total_deaths'])
>>> 6793224

# Timestamp of last update (in DD/MM/YYYY HH:MM format)
print(global_totals['timestamp'])
>>> "01/05/2023 at 16:05 GMT"

Data Sources

The data used in this project is sourced from the covid19api.com service, where data has been provided by Johns Hopkins CSSE, Our World In Data and the Oxford COVID-19 Government Response Tracker.

License

The code in this project is licensed under the GNU GPLv3 license. See LICENSE for more information.

(c) 2021-2023 Am I Going On Holiday? with data from covid19api.com.

About

πŸ“œ covid19api.com Python API client (historical archive)

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages