AsyncOpenAQ
AsyncOpenAQ
OpenAQ asynchronous client.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
api_key
|
Union[str, None]
|
The API key for accessing the service. |
None
|
user_agent
|
str
|
The user agent string to be used in requests. |
DEFAULT_USER_AGENT
|
headers
|
Mapping[str, str]
|
Additional headers to be sent with the request. |
{}
|
base_url
|
str
|
The base URL for the API endpoint. |
DEFAULT_BASE_URL
|
Note
An API key can either be passed directly to the OpenAQ client class at
instantiation or can be accessed from a system environment variable
name OPENAQ-API-KEY
. An API key added at instantiation will always
override one set in the environment variable.
Warning
Although the api_key
parameter is not required for instantiating the
OpenAQ client, an API Key is required for using the OpenAQ API.
Raises:
Type | Description |
---|---|
AuthError
|
Authentication error, improperly supplied credentials. |
BadRequestError
|
Raised for HTTP 400 error, indicating a client request error. |
NotAuthorized
|
Raised for HTTP 401 error, indicating the client is not authorized. |
Forbidden
|
Raised for HTTP 403 error, indicating the request is forbidden. |
NotFoundError
|
Raised for HTTP 404 error, indicating a resource is not found. |
ValidationError
|
Raised for HTTP 422 error, indicating invalid request parameters. |
RateLimit
|
Raised for HTTP 429 error, indicating rate limit exceeded. |
ServerError
|
Raised for HTTP 500 error, indicating an internal server error or unexpected server-side issue. |
GatewayTimeoutError
|
Raised for HTTP 504 error, indicating a gateway timeout. |
Source code in openaq/_async/client.py
Locations
This provides methods to retrieve air monitor locations resource from the OpenAQ API.
Source code in openaq/_async/models/locations.py
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 |
|
get(locations_id)
async
Retrieve a specific location by its locations ID.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
locations_id
|
int
|
The locations ID of the location to retrieve. |
required |
Returns:
Name | Type | Description |
---|---|---|
LocationsResponse |
LocationsResponse
|
An instance representing the retrieved location. |
Raises:
Type | Description |
---|---|
BadRequestError
|
Raised for HTTP 400 error, indicating a client request error. |
NotAuthorized
|
Raised for HTTP 401 error, indicating the client is not authorized. |
Forbidden
|
Raised for HTTP 403 error, indicating the request is forbidden. |
NotFoundError
|
Raised for HTTP 404 error, indicating a resource is not found. |
ValidationError
|
Raised for HTTP 422 error, indicating invalid request parameters. |
RateLimit
|
Raised for HTTP 429 error, indicating rate limit exceeded. |
ServerError
|
Raised for HTTP 500 error, indicating an internal server error or unexpected server-side issue. |
GatewayTimeoutError
|
Raised for HTTP 504 error, indicating a gateway timeout. |
Source code in openaq/_async/models/locations.py
latest(locations_id)
async
Retrieve latest measurements from a location.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
locations_id
|
int
|
The locations ID of the location to retrieve. |
required |
Returns:
Name | Type | Description |
---|---|---|
LatestResponse |
LatestResponse
|
An instance representing the retrieved latest results. |
Raises:
Type | Description |
---|---|
BadRequestError
|
Raised for HTTP 400 error, indicating a client request error. |
NotAuthorized
|
Raised for HTTP 401 error, indicating the client is not authorized. |
Forbidden
|
Raised for HTTP 403 error, indicating the request is forbidden. |
NotFoundError
|
Raised for HTTP 404 error, indicating a resource is not found. |
ValidationError
|
Raised for HTTP 422 error, indicating invalid request parameters. |
RateLimit
|
Raised for HTTP 429 error, indicating rate limit exceeded. |
ServerError
|
Raised for HTTP 500 error, indicating an internal server error or unexpected server-side issue. |
GatewayTimeoutError
|
Raised for HTTP 504 error, indicating a gateway timeout. |
Source code in openaq/_async/models/locations.py
list(page=1, limit=100, radius=None, coordinates=None, bbox=None, providers_id=None, countries_id=None, parameters_id=None, licenses_id=None, iso=None, monitor=None, mobile=None, order_by=None, sort_order=None)
async
List locations based on provided filters.
Provides the ability to filter the locations resource by the given arguments.
page
- Specifies the page number of results to retrievelimit
- Sets the number of results generated per pageradius
- Specifies the distance around a central point, filtering locations within a circular area. Must be used withcoordinates
, cannot be used in combination withbbox
coordinates
- Filters locations by coordinates. Must be used withradius
, cannot be used in combination withbbox
bbox
- Filters locations using a bounding box. Cannot be used withcoordinates
orradius
providers_id
- Filters results by selected providers ID(s)countries_id
- Filters results by selected countries ID(s)parameters_id
- Filters results by selected parameters ID(s)licenses_id
- Filters results by selected licenses ID(s)iso
- Filters results by selected country codemonitor
- Filters results by reference grade monitors (true
), air sensors (false
), or both if not usedmobile
- Filters results for mobile sensors (true
), non-mobile sensors (false
), or both if not usedorder_by
- Determines the fields by which results are sorted; available values areid
sort_order
- Works in tandem withorder_by
to specify the direction: eitherasc
(ascending) ordesc
(descending)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
page
|
int
|
The page number. Page count is locations found / limit. |
1
|
limit
|
int
|
The number of results returned per page. |
100
|
radius
|
Union[int, None]
|
A distance value in meters to search around the given coordinates value. |
None
|
coordinates
|
Union[Tuple[float, float], None]
|
WGS 84 coordinate pair in form latitude, longitude (y,x). |
None
|
bbox
|
Union[Tuple[float, float, float, float], None]
|
Geospatial bounding box of min X, min Y, max X, max Y in WGS 84 coordinates. Limited to four decimals precision. |
None
|
providers_id
|
Union[int, List[int], None]
|
Single providers ID or an array of IDs. |
None
|
countries_id
|
Union[int, List[int], None]
|
Single countries ID or an array of IDs. |
None
|
parameters_id
|
Union[int, List[int], None]
|
Single parameters ID or an array of IDs. |
None
|
licenses_id
|
Union[int, List[int], None]
|
Single licenses ID or an array of IDs. |
None
|
iso
|
Union[str, None]
|
2 letter ISO 3166-alpha-2 country code. |
None
|
monitor
|
Union[bool, None]
|
Boolean for reference grade monitors (true) or air sensors (false) |
None
|
mobile
|
Union[bool, None]
|
Boolean mobile locations (true) or not mobile locations (false). |
None
|
order_by
|
Union[str, None]
|
Order by operators for results. |
None
|
sort_order
|
Union[str, None]
|
Sort order (asc/desc). |
None
|
Returns:
Name | Type | Description |
---|---|---|
LocationsResponse |
LocationsResponse
|
An instance representing the list of retrieved locations. |
Raises:
Type | Description |
---|---|
BadRequestError
|
Raised for HTTP 400 error, indicating a client request error. |
NotAuthorized
|
Raised for HTTP 401 error, indicating the client is not authorized. |
Forbidden
|
Raised for HTTP 403 error, indicating the request is forbidden. |
NotFoundError
|
Raised for HTTP 404 error, indicating a resource is not found. |
ValidationError
|
Raised for HTTP 422 error, indicating invalid request parameters. |
RateLimit
|
Raised for HTTP 429 error, indicating rate limit exceeded. |
ServerError
|
Raised for HTTP 500 error, indicating an internal server error or unexpected server-side issue. |
GatewayTimeoutError
|
Raised for HTTP 504 error, indicating a gateway timeout. |
Source code in openaq/_async/models/locations.py
sensors(locations_id)
async
Retrieve sensors from a location.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
locations_id
|
int
|
The locations ID of the location to retrieve. |
required |
Returns:
Name | Type | Description |
---|---|---|
SensorsResponse |
SensorsResponse
|
An instance representing the retrieved latest results. |
Raises:
Type | Description |
---|---|
BadRequestError
|
Raised for HTTP 400 error, indicating a client request error. |
NotAuthorized
|
Raised for HTTP 401 error, indicating the client is not authorized. |
Forbidden
|
Raised for HTTP 403 error, indicating the request is forbidden. |
NotFoundError
|
Raised for HTTP 404 error, indicating a resource is not found. |
ValidationError
|
Raised for HTTP 422 error, indicating invalid request parameters. |
RateLimit
|
Raised for HTTP 429 error, indicating rate limit exceeded. |
ServerError
|
Raised for HTTP 500 error, indicating an internal server error or unexpected server-side issue. |
GatewayTimeoutError
|
Raised for HTTP 504 error, indicating a gateway timeout. |
Source code in openaq/_async/models/locations.py
Measurements
This provides methods to retrieve and list the air quality measurements from the OpenAQ API.
Source code in openaq/_async/models/measurements.py
list(sensors_id, data=None, rollup=None, date_from='2016-10-10', date_to=None, page=1, limit=1000)
async
List air quality measurements based on provided filters.
Provides the ability to filter the measurements resource by location, date range, pagination settings, and specific parameters.
sensors_id
- Filters measurements to a specific sensors ID (required)data
- the base measurement unit to query. options are 'measurements', 'hours', 'days', 'years'rollup
- the period by which to rollup the base measurement data. Options are 'hourly', 'daily', 'yearly'date_from
- Declare a start time for data retrievaldate_to
- Declare an end time or data retrievalpage
- Specifies the page number of results to retrievelimit
- Sets the number of results generated per page
Parameters:
Name | Type | Description | Default |
---|---|---|---|
sensors_id
|
int
|
The ID of the sensor for which measurements should be retrieved. |
required |
data
|
Union[Data, None]
|
The base measurement unit to query |
None
|
rollup
|
Union[Rollup, None]
|
The period by which to rollup the base measurement data. |
None
|
date_from
|
Union[datetime, str, None]
|
Starting date for the measurement retrieval. Can be a datetime object or ISO-8601 formatted date or datetime string. |
'2016-10-10'
|
date_to
|
Union[datetime, str, None]
|
Ending date for the measurement retrieval. Can be a datetime object or ISO-8601 formatted date or datetime string. |
None
|
page
|
int
|
The page number to fetch. Page count is determined by total measurements found divided by the limit. |
1
|
limit
|
int
|
The number of results returned per page. |
1000
|
Returns:
Name | Type | Description |
---|---|---|
MeasurementsResponse |
MeasurementsResponse
|
An instance representing the list of retrieved air quality measurements. |
Raises:
Type | Description |
---|---|
BadRequestError
|
Raised for HTTP 400 error, indicating a client request error. |
NotAuthorized
|
Raised for HTTP 401 error, indicating the client is not authorized. |
Forbidden
|
Raised for HTTP 403 error, indicating the request is forbidden. |
NotFoundError
|
Raised for HTTP 404 error, indicating a resource is not found. |
ValidationError
|
Raised for HTTP 422 error, indicating invalid request parameters. |
RateLimit
|
Raised for HTTP 429 error, indicating rate limit exceeded. |
ServerError
|
Raised for HTTP 500 error, indicating an internal server error or unexpected server-side issue. |
GatewayTimeoutError
|
Raised for HTTP 504 error, indicating a gateway timeout. |
Source code in openaq/_async/models/measurements.py
Countries
This provides methods to retrieve country data from the OpenAQ API.
Source code in openaq/_async/models/countries.py
get(countries_id)
async
Retrieve specific country data by its countries ID.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
countries_id
|
int
|
The countries ID of the country to retrieve. |
required |
Returns:
Name | Type | Description |
---|---|---|
CountriesResponse |
CountriesResponse
|
An instance representing the retrieved country. |
Raises:
Type | Description |
---|---|
BadRequestError
|
Raised for HTTP 400 error, indicating a client request error. |
NotAuthorized
|
Raised for HTTP 401 error, indicating the client is not authorized. |
Forbidden
|
Raised for HTTP 403 error, indicating the request is forbidden. |
NotFoundError
|
Raised for HTTP 404 error, indicating a resource is not found. |
ValidationError
|
Raised for HTTP 422 error, indicating invalid request parameters. |
RateLimit
|
Raised for HTTP 429 error, indicating rate limit exceeded. |
ServerError
|
Raised for HTTP 500 error, indicating an internal server error or unexpected server-side issue. |
GatewayTimeoutError
|
Raised for HTTP 504 error, indicating a gateway timeout. |
Source code in openaq/_async/models/countries.py
list(page=1, limit=1000, order_by=None, sort_order=None, parameters_id=None, providers_id=None)
async
List countries based on provided filters.
Provides the ability to filter the countries resource by the given arguments.
page
- Specifies the page number of results to retrievelimit
- Sets the number of results generated per pageproviders_id
- Filter results by selected providers ID(s)parameters_id
- Filters results by selected parameters ID(s)order_by
- Determines the fields by which results are sorted; available values areid
sort_order
- Works in tandem withorder_by
to specify the direction: eitherasc
(ascending) ordesc
(descending)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
page
|
int
|
The page number. Page count is countries found / limit. |
1
|
limit
|
int
|
The number of results returned per page. |
1000
|
order_by
|
str
|
Order by operators for results. |
None
|
sort_order
|
str
|
Sort order (asc/desc). |
None
|
parameters_id
|
int
|
Single parameters ID or an array of IDs. |
None
|
providers_id
|
int
|
Single providers ID or an array of IDs. |
None
|
Returns:
Name | Type | Description |
---|---|---|
CountriesResponse |
CountriesResponse
|
An instance representing the list of retrieved countries. |
Raises:
Type | Description |
---|---|
BadRequestError
|
Raised for HTTP 400 error, indicating a client request error. |
NotAuthorized
|
Raised for HTTP 401 error, indicating the client is not authorized. |
Forbidden
|
Raised for HTTP 403 error, indicating the request is forbidden. |
NotFoundError
|
Raised for HTTP 404 error, indicating a resource is not found. |
ValidationError
|
Raised for HTTP 422 error, indicating invalid request parameters. |
RateLimit
|
Raised for HTTP 429 error, indicating rate limit exceeded. |
ServerError
|
Raised for HTTP 500 error, indicating an internal server error or unexpected server-side issue. |
GatewayTimeoutError
|
Raised for HTTP 504 error, indicating a gateway timeout. |
Source code in openaq/_async/models/countries.py
Instruments
This provides methods to retrieve instrument data from the OpenAQ API.
Source code in openaq/_async/models/instruments.py
get(providers_id)
async
Retrieve specific instrument data by its providers ID.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
providers_id
|
int
|
The providers ID of the instrument to retrieve. |
required |
Returns:
Name | Type | Description |
---|---|---|
InstrumentsResponse |
InstrumentsResponse
|
An instance representing the retrieved instrument. |
Raises:
Type | Description |
---|---|
BadRequestError
|
Raised for HTTP 400 error, indicating a client request error. |
NotAuthorized
|
Raised for HTTP 401 error, indicating the client is not authorized. |
Forbidden
|
Raised for HTTP 403 error, indicating the request is forbidden. |
NotFoundError
|
Raised for HTTP 404 error, indicating a resource is not found. |
ValidationError
|
Raised for HTTP 422 error, indicating invalid request parameters. |
RateLimit
|
Raised for HTTP 429 error, indicating rate limit exceeded. |
ServerError
|
Raised for HTTP 500 error, indicating an internal server error or unexpected server-side issue. |
GatewayTimeoutError
|
Raised for HTTP 504 error, indicating a gateway timeout. |
Source code in openaq/_async/models/instruments.py
list(page=1, limit=1000, order_by=None, sort_order=None)
async
List instruments based on provided filters.
Provides the ability to filter the instruments resource by the given arguments.
page
- Specifies the page number of results to retrieve.limit
- Sets the number of results generated per pageorder_by
- Determines the fields by which results are sorted; available values areid
sort_order
- Works in tandem withorder_by
to specify the direction: eitherasc
(ascending) ordesc
(descending)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
page
|
int
|
The page number. Page count is instruments found / limit. |
1
|
limit
|
int
|
The number of results returned per page. |
1000
|
order_by
|
str
|
Order by operators for results. |
None
|
sort_order
|
str
|
Sort order (asc/desc). |
None
|
Returns:
Name | Type | Description |
---|---|---|
InstrumentsResponse |
InstrumentsResponse
|
An instance representing the list of retrieved instruments. |
Raises:
Type | Description |
---|---|
BadRequestError
|
Raised for HTTP 400 error, indicating a client request error. |
NotAuthorized
|
Raised for HTTP 401 error, indicating the client is not authorized. |
Forbidden
|
Raised for HTTP 403 error, indicating the request is forbidden. |
NotFoundError
|
Raised for HTTP 404 error, indicating a resource is not found. |
ValidationError
|
Raised for HTTP 422 error, indicating invalid request parameters. |
RateLimit
|
Raised for HTTP 429 error, indicating rate limit exceeded. |
ServerError
|
Raised for HTTP 500 error, indicating an internal server error or unexpected server-side issue. |
GatewayTimeoutError
|
Raised for HTTP 504 error, indicating a gateway timeout. |
Source code in openaq/_async/models/instruments.py
Licenses
This provides methods to retrieve air monitor locations resource from the OpenAQ API.
Source code in openaq/_async/models/licenses.py
get(licenses_id)
async
Retrieve a specific license by its licenses ID.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
licenses_id
|
int
|
The licenses ID of the license to retrieve. |
required |
Returns:
Name | Type | Description |
---|---|---|
LicensesReponse |
LicensesResponse
|
An instance representing the retrieved license. |
Raises:
Type | Description |
---|---|
BadRequestError
|
Raised for HTTP 400 error, indicating a client request error. |
NotAuthorized
|
Raised for HTTP 401 error, indicating the client is not authorized. |
Forbidden
|
Raised for HTTP 403 error, indicating the request is forbidden. |
NotFoundError
|
Raised for HTTP 404 error, indicating a resource is not found. |
ValidationError
|
Raised for HTTP 422 error, indicating invalid request parameters. |
RateLimit
|
Raised for HTTP 429 error, indicating rate limit exceeded. |
ServerError
|
Raised for HTTP 500 error, indicating an internal server error or unexpected server-side issue. |
GatewayTimeoutError
|
Raised for HTTP 504 error, indicating a gateway timeout. |
Source code in openaq/_async/models/licenses.py
list(page=1, limit=1000, order_by=None, sort_order=None)
async
List licenses based on provided filters.
Provides the ability to filter the locations resource by the given arguments.
page
- Specifies the page number of results to retrievelimit
- Sets the number of results generated per pageorder_by
- Determines the fields by which results are sorted; available values areid
sort_order
- Works in tandem withorder_by
to specify the direction: eitherasc
(ascending) ordesc
(descending)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
page
|
int
|
The page number. Page count is locations found / limit. |
1
|
limit
|
int
|
The number of results returned per page. |
1000
|
order_by
|
Union[str, None]
|
Order by operators for results. |
None
|
sort_order
|
Union[str, None]
|
Sort order (asc/desc). |
None
|
Returns:
Name | Type | Description |
---|---|---|
LicensesReponse |
LicensesResponse
|
An instance representing the list of retrieved licenses. |
Raises:
Type | Description |
---|---|
BadRequestError
|
Raised for HTTP 400 error, indicating a client request error. |
NotAuthorized
|
Raised for HTTP 401 error, indicating the client is not authorized. |
Forbidden
|
Raised for HTTP 403 error, indicating the request is forbidden. |
NotFoundError
|
Raised for HTTP 404 error, indicating a resource is not found. |
ValidationError
|
Raised for HTTP 422 error, indicating invalid request parameters. |
RateLimit
|
Raised for HTTP 429 error, indicating rate limit exceeded. |
ServerError
|
Raised for HTTP 500 error, indicating an internal server error or unexpected server-side issue. |
GatewayTimeoutError
|
Raised for HTTP 504 error, indicating a gateway timeout. |
Source code in openaq/_async/models/licenses.py
Manufacturers
This provides methods to retrieve manufacturer data from the OpenAQ API.
Source code in openaq/_async/models/manufacturers.py
get(manufacturers_id)
async
Retrieve specific manufacturer data by its manufacturers ID.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
manufacturers_id
|
int
|
The manufacturers ID of the manufacturer to retrieve. |
required |
Returns:
Name | Type | Description |
---|---|---|
ManufacturersResponse |
ManufacturersResponse
|
An instance representing the retrieved manufacturer. |
Raises:
Type | Description |
---|---|
BadRequestError
|
Raised for HTTP 400 error, indicating a client request error. |
NotAuthorized
|
Raised for HTTP 401 error, indicating the client is not authorized. |
Forbidden
|
Raised for HTTP 403 error, indicating the request is forbidden. |
NotFoundError
|
Raised for HTTP 404 error, indicating a resource is not found. |
ValidationError
|
Raised for HTTP 422 error, indicating invalid request parameters. |
RateLimit
|
Raised for HTTP 429 error, indicating rate limit exceeded. |
ServerError
|
Raised for HTTP 500 error, indicating an internal server error or unexpected server-side issue. |
GatewayTimeoutError
|
Raised for HTTP 504 error, indicating a gateway timeout. |
Source code in openaq/_async/models/manufacturers.py
instruments(manufacturers_id)
async
Retrieve instruments of a manufacturer by ID.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
manufacturers_id
|
int
|
The manufacturers ID of the manufacturer to retrieve. |
required |
Returns:
Name | Type | Description |
---|---|---|
InstrumentsResponse |
InstrumentsResponse
|
An instance representing the retrieved instruments. |
Raises:
Type | Description |
---|---|
BadRequestError
|
Raised for HTTP 400 error, indicating a client request error. |
NotAuthorized
|
Raised for HTTP 401 error, indicating the client is not authorized. |
Forbidden
|
Raised for HTTP 403 error, indicating the request is forbidden. |
NotFoundError
|
Raised for HTTP 404 error, indicating a resource is not found. |
ValidationError
|
Raised for HTTP 422 error, indicating invalid request parameters. |
RateLimit
|
Raised for HTTP 429 error, indicating rate limit exceeded. |
ServerError
|
Raised for HTTP 500 error, indicating an internal server error or unexpected server-side issue. |
GatewayTimeoutError
|
Raised for HTTP 504 error, indicating a gateway timeout. |
Source code in openaq/_async/models/manufacturers.py
list(page=1, limit=1000, order_by=None, sort_order=None)
async
List manufacturers based on provided filters.
Provides the ability to filter the manufacturers resource by the given arguments.
page
- Specifies the page number of results to retrievelimit
- Sets the number of results generated per pageorder_by
- Determines the fields by which results are sorted; available values areid
sort_order
- Works in tandem withorder_by
to specify the direction: eitherasc
(ascending) ordesc
(descending)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
page
|
int
|
The page number. Page count is manufacturers found / limit. |
1
|
limit
|
int
|
The number of results returned per page. |
1000
|
order_by
|
str
|
Order by operators for results. |
None
|
sort_order
|
str
|
Sort order (asc/desc). |
None
|
Returns:
Name | Type | Description |
---|---|---|
ManufacturersResponse |
ManufacturersResponse
|
An instance representing the list of retrieved manufacturers. |
Raises:
Type | Description |
---|---|
BadRequestError
|
Raised for HTTP 400 error, indicating a client request error. |
NotAuthorized
|
Raised for HTTP 401 error, indicating the client is not authorized. |
Forbidden
|
Raised for HTTP 403 error, indicating the request is forbidden. |
NotFoundError
|
Raised for HTTP 404 error, indicating a resource is not found. |
ValidationError
|
Raised for HTTP 422 error, indicating invalid request parameters. |
RateLimit
|
Raised for HTTP 429 error, indicating rate limit exceeded. |
ServerError
|
Raised for HTTP 500 error, indicating an internal server error or unexpected server-side issue. |
GatewayTimeoutError
|
Raised for HTTP 504 error, indicating a gateway timeout. |
Source code in openaq/_async/models/manufacturers.py
Owners
This provides methods to retrieve owner data from the OpenAQ API.
Source code in openaq/_async/models/owners.py
get(owners_id)
async
Retrieve specific owner data by its owners ID.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
owners_id
|
int
|
The owners ID of the owner to retrieve. |
required |
Returns:
Name | Type | Description |
---|---|---|
OwnersResponse |
OwnersResponse
|
An instance representing the retrieved owner. |
Raises:
Type | Description |
---|---|
BadRequestError
|
Raised for HTTP 400 error, indicating a client request error. |
NotAuthorized
|
Raised for HTTP 401 error, indicating the client is not authorized. |
Forbidden
|
Raised for HTTP 403 error, indicating the request is forbidden. |
NotFoundError
|
Raised for HTTP 404 error, indicating a resource is not found. |
ValidationError
|
Raised for HTTP 422 error, indicating invalid request parameters. |
RateLimit
|
Raised for HTTP 429 error, indicating rate limit exceeded. |
ServerError
|
Raised for HTTP 500 error, indicating an internal server error or unexpected server-side issue. |
GatewayTimeoutError
|
Raised for HTTP 504 error, indicating a gateway timeout. |
Source code in openaq/_async/models/owners.py
list(page=1, limit=1000, order_by=None, sort_order=None)
async
List owners based on provided filters.
Provides the ability to filter the owners resource by the given arguments.
page
- Specifies the page number of results to retrievelimit
- Sets the number of results generated per pageorder_by
- Determines the fields by which results are sorted; available values areid
sort_order
- Works in tandem withorder_by
to specify the direction: eitherasc
(ascending) ordesc
(descending)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
page
|
int
|
The page number. Page count is owners found / limit. |
1
|
limit
|
int
|
The number of results returned per page. |
1000
|
order_by
|
str
|
Order by operators for results. |
None
|
sort_order
|
str
|
Sort order (asc/desc). |
None
|
Returns:
Name | Type | Description |
---|---|---|
OwnersResponse |
OwnersResponse
|
An instance representing the list of retrieved owners. |
Raises:
Type | Description |
---|---|
BadRequestError
|
Raised for HTTP 400 error, indicating a client request error. |
NotAuthorized
|
Raised for HTTP 401 error, indicating the client is not authorized. |
Forbidden
|
Raised for HTTP 403 error, indicating the request is forbidden. |
NotFoundError
|
Raised for HTTP 404 error, indicating a resource is not found. |
ValidationError
|
Raised for HTTP 422 error, indicating invalid request parameters. |
RateLimit
|
Raised for HTTP 429 error, indicating rate limit exceeded. |
ServerError
|
Raised for HTTP 500 error, indicating an internal server error or unexpected server-side issue. |
GatewayTimeoutError
|
Raised for HTTP 504 error, indicating a gateway timeout. |
Source code in openaq/_async/models/owners.py
Parameters
This provides methods to retrieve parameter data from the OpenAQ API.
Source code in openaq/_async/models/parameters.py
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 |
|
get(parameters_id)
async
Retrieve specific parameter data by its parameters ID.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
parameters_id
|
int
|
The parameters ID of the parameter to retrieve. |
required |
Returns:
Name | Type | Description |
---|---|---|
ParametersResponse |
ParametersResponse
|
An instance representing the retrieved parameter. |
Raises:
Type | Description |
---|---|
BadRequestError
|
Raised for HTTP 400 error, indicating a client request error. |
NotAuthorized
|
Raised for HTTP 401 error, indicating the client is not authorized. |
Forbidden
|
Raised for HTTP 403 error, indicating the request is forbidden. |
NotFoundError
|
Raised for HTTP 404 error, indicating a resource is not found. |
ValidationError
|
Raised for HTTP 422 error, indicating invalid request parameters. |
RateLimit
|
Raised for HTTP 429 error, indicating rate limit exceeded. |
ServerError
|
Raised for HTTP 500 error, indicating an internal server error or unexpected server-side issue. |
GatewayTimeoutError
|
Raised for HTTP 504 error, indicating a gateway timeout. |
Source code in openaq/_async/models/parameters.py
latest(parameters_id)
async
Retrieve latest measurements from a location.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
parameters_id
|
int
|
The locations ID of the location to retrieve. |
required |
Returns:
Name | Type | Description |
---|---|---|
LatestResponse |
LatestResponse
|
An instance representing the retrieved latest results. |
Raises:
Type | Description |
---|---|
BadRequestError
|
Raised for HTTP 400 error, indicating a client request error. |
NotAuthorized
|
Raised for HTTP 401 error, indicating the client is not authorized. |
Forbidden
|
Raised for HTTP 403 error, indicating the request is forbidden. |
NotFoundError
|
Raised for HTTP 404 error, indicating a resource is not found. |
ValidationError
|
Raised for HTTP 422 error, indicating invalid request parameters. |
RateLimit
|
Raised for HTTP 429 error, indicating rate limit exceeded. |
ServerError
|
Raised for HTTP 500 error, indicating an internal server error or unexpected server-side issue. |
GatewayTimeoutError
|
Raised for HTTP 504 error, indicating a gateway timeout. |
Source code in openaq/_async/models/parameters.py
list(page=1, limit=1000, order_by=None, sort_order=None, parameter_type=None, coordinates=None, radius=None, bbox=None, iso=None, countries_id=None)
async
List parameters based on provided filters.
Provides the ability to filter the parameters resource by the given arguments.
page
- Specifies the page number of results to retrievelimit
- Sets the number of results generated per pageparameter_type
- Filters results by type of parameter (pollutant or meteorological)radius
- Defines the distance around a given point to filter locations within that circular area. Always use withcoordinates
and not withbbox
coordinates
- Filters locations by coordinates. Must be used withradius
, cannot be used in combination withbbox
bbox
- Filters locations using a bounding box. Cannot be used withcoordinates
orradius
iso
- Filters results by selected country codecountries_id
- Filters results by selected countries ID(s)order_by
- Determines the fields by which results are sorted; available values areid
sort_order
- Works in tandem withorder_by
to specify the direction: eitherasc
(ascending) ordesc
(descending)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
page
|
int
|
The page number. Page count is parameters found / limit. |
1
|
limit
|
int
|
The number of results returned per page. |
1000
|
parameter_type
|
str
|
pollutant or meteorological. |
None
|
radius
|
int
|
A distance value in meters to search around the given coordinates value. |
None
|
coordinates
|
tuple
|
WGS 84 coordinate pair in form latitude, longitude (y,x). |
None
|
bbox
|
tuple
|
Geospatial bounding box of min X, min Y, max X, max Y in WGS 84 coordinates. Limited to four decimals precision. |
None
|
iso
|
str
|
2 letter ISO 3166-alpha-2 country code. |
None
|
countries_id
|
int
|
Single countries ID or an array of IDs. |
None
|
order_by
|
str
|
Order by operators for results. |
None
|
sort_order
|
str
|
Sort order (asc/desc). |
None
|
Returns:
Name | Type | Description |
---|---|---|
ParametersResponse |
ParametersResponse
|
An instance representing the list of retrieved parameters. |
Raises:
Type | Description |
---|---|
BadRequestError
|
Raised for HTTP 400 error, indicating a client request error. |
NotAuthorized
|
Raised for HTTP 401 error, indicating the client is not authorized. |
Forbidden
|
Raised for HTTP 403 error, indicating the request is forbidden. |
NotFoundError
|
Raised for HTTP 404 error, indicating a resource is not found. |
ValidationError
|
Raised for HTTP 422 error, indicating invalid request parameters. |
RateLimit
|
Raised for HTTP 429 error, indicating rate limit exceeded. |
ServerError
|
Raised for HTTP 500 error, indicating an internal server error or unexpected server-side issue. |
GatewayTimeoutError
|
Raised for HTTP 504 error, indicating a gateway timeout. |
Source code in openaq/_async/models/parameters.py
Providers
This provides methods to retrieve provider data from the OpenAQ API.
Source code in openaq/_async/models/providers.py
get(providers_id)
async
Retrieve specific provider data by its providers ID.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
providers_id
|
int
|
The providers ID of the provider to retrieve. |
required |
Returns:
Name | Type | Description |
---|---|---|
ProvidersResponse |
ProvidersResponse
|
An instance representing the retrieved provider. |
Source code in openaq/_async/models/providers.py
list(page=1, limit=1000, order_by=None, sort_order=None, parameters_id=None, monitor=None, coordinates=None, radius=None, bbox=None, iso=None, countries_id=None)
async
List providers based on provided filters.
Provides the ability to filter the providers resource by the given arguments.
page
- Specifies the page number of results to retrievelimit
- Sets the number of results generated per pageparameters_id
- Filters results by selected parameters ID(s)monitor
- Filters results by reference grade monitors (true
), air sensors (false
), or both if not usedradius
- Defines the distance around a given point to filter locations within that circular area. Always use withcoordinates
and not withbbox
coordinates
- Filters locations by coordinates. Must be used withradius
, cannot be used in combination withbbox
bbox
- Filters locations using a bounding box. Cannot be used withcoordinates
orradius
iso
- Filters results by selected country codecountries_id
- Filter results by selected countries ID(s)order_by
- Determines the fields by which results are sorted; available values areid
sort_order
- Works in tandem withorder_by
to specify the direction: eitherasc
(ascending) ordesc
(descending)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
page
|
int
|
The page number. Page count is providers found / limit. |
1
|
limit
|
int
|
The number of results returned per page. |
1000
|
parameters_id
|
int
|
Single parameters ID or an array of IDs. |
None
|
monitor
|
bool
|
Boolean for reference grade monitors (true) or air sensors (false). |
None
|
radius
|
int
|
A distance value in meters to search around the given coordinates value. |
None
|
coordinates
|
tuple
|
WGS 84 coordinate pair in form latitude, longitude (y,x). |
None
|
bbox
|
tuple
|
Geospatial bounding box of min X, min Y, max X, max Y in WGS 84 coordinates. Limited to four decimals precision. |
None
|
iso
|
str
|
2 letter ISO 3166-alpha-2 country code. |
None
|
countries_id
|
int
|
Single countries ID or an array of IDs. |
None
|
order_by
|
str
|
Order by operators for results. |
None
|
sort_order
|
str
|
Sort order (asc/desc). |
None
|
Returns:
Name | Type | Description |
---|---|---|
ProvidersResponse |
ProvidersResponse
|
An instance representing the list of retrieved providers. |
Raises:
Type | Description |
---|---|
BadRequestError
|
Raised for HTTP 400 error, indicating a client request error. |
NotAuthorized
|
Raised for HTTP 401 error, indicating the client is not authorized. |
Forbidden
|
Raised for HTTP 403 error, indicating the request is forbidden. |
NotFoundError
|
Raised for HTTP 404 error, indicating a resource is not found. |
ValidationError
|
Raised for HTTP 422 error, indicating invalid request parameters. |
RateLimit
|
Raised for HTTP 429 error, indicating rate limit exceeded. |
ServerError
|
Raised for HTTP 500 error, indicating an internal server error or unexpected server-side issue. |
GatewayTimeoutError
|
Raised for HTTP 504 error, indicating a gateway timeout. |
Source code in openaq/_async/models/providers.py
Sensors
This provides methods to retrieve sensor data from the OpenAQ API.
Source code in openaq/_async/models/sensors.py
get(sensors_id)
async
Retrieve specific sensor data by its sensors ID.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
sensors_id
|
int
|
The sensors ID of the sensor to retrieve. |
required |
Returns:
Name | Type | Description |
---|---|---|
SensorsResponse |
SensorsResponse
|
An instance representing the retrieved sensor. |
Raises:
Type | Description |
---|---|
BadRequestError
|
Raised for HTTP 400 error, indicating a client request error. |
NotAuthorized
|
Raised for HTTP 401 error, indicating the client is not authorized. |
Forbidden
|
Raised for HTTP 403 error, indicating the request is forbidden. |
NotFoundError
|
Raised for HTTP 404 error, indicating a resource is not found. |
ValidationError
|
Raised for HTTP 422 error, indicating invalid request parameters. |
RateLimit
|
Raised for HTTP 429 error, indicating rate limit exceeded. |
ServerError
|
Raised for HTTP 500 error, indicating an internal server error or unexpected server-side issue. |
GatewayTimeoutError
|
Raised for HTTP 504 error, indicating a gateway timeout. |