Python client for covid-local-api, a REST API to get local information and addresses on COVID-19 (hotlines, websites, test sites, health departments).
This Python package is automatically generated by the OpenAPI Generator project.
Python 2.7 or 3.4+
You can install directly with pip from github:
pip install git+https://github.com/cotect/covid-local-py.git
Or manually with Setuptools:
git clone https://github.com/cotect/covid-local-py.git
python setup.py install
import covid_local
# Create API client
with covid_local.ApiClient() as api_client:
# Create API instance - this is the main object to use
api_instance = covid_local.DefaultApi(api_client)
try:
# Get all items (hotlines, websites, test sites, health departments)
# for Berlin Mitte
result = api_instance.get_all(place_name="Berlin Mitte")
print(result)
# Get the 3 closest test sites for Berlin Mitte
result = api_instance.get_test_sites(place_name="Berlin Mitte", limit=3)
print(result)
# Do the same thing, but define the place via its geonames.org ID
result = api_instance.get_test_sites(geonames_id=2950159, limit=3)
print(result)
# Search for places matching the query "Berlin Mitte"
# (this will also yield the geonames IDs of these places)
result = api_instance.search_places(q="Berlin Mitte")
print(result)
except covid_local.rest.ApiException as e:
print(f"Exception when calling API endpoint: {e}")
For further documentation, see below and the readme file of covid-local-api.
All URIs are relative to http://ec2-3-90-67-33.compute-1.amazonaws.com
Class | Method | HTTP request | Description |
---|---|---|---|
DefaultApi | get_all | GET /all | Get all items for a place |
DefaultApi | get_health_departments | GET /health_departments | Get responsible health departments for a place |
DefaultApi | get_hotlines | GET /hotlines | Get hotlines for a place |
DefaultApi | get_test_sites | GET /test_sites | Get nearby test sites for a place (sorted by distance to place) |
DefaultApi | get_websites | GET /websites | Get websites for a place |
DefaultApi | search_places | GET /places | Search for places via free-form query |
DefaultApi | test | GET /test | Shows all entries for Berlin Mitte (redirects to /all endpoint) |