Skip to content

Latest commit

 

History

History
52 lines (33 loc) · 1.27 KB

README.md

File metadata and controls

52 lines (33 loc) · 1.27 KB

WAQI Python Client

Python client library for the World Air Quality Index (WAQI) APIs. See documentation here. All available API modules are supported - City feed, Geolocalized feed, Search, and Map Queries.

Installation

Coming soon...

Get API key

Sign up for an API key here

Making Requests

The primary WaqiAPI class in the waqi_api module is a factory class that creates objects for each of the API modules, allowing you to make requests to any of them with your desired request parameters. You have to first create an object for it, then access your desired API module via the object. See the code snippets below:

from waqi_api import WaqiAPI

api = WaqiAPI(WAQI_TOKEN)

For City Feed:

response = api.city_feed().set_city("Munich").fetch()

For Search:

response = api.search().set_keyword("Johannesburg").fetch()

For Lat/Lng based Geolocalized feed:

response = api.geo_feed().set_coordinates(37.7749, -122.4194).fetch()

For IP based Geolocalized feed:

response = api.ip_feed().set_ip("MY_IP").fetch()

For Map Queries:

response = api.map_station().set_map_bounds(40.712, -74.006, 34.052, -118.243).fetch()