$PRECONNECT_LINK $PRECONNECT_LINK $PRECONNECT_LINK $PRECONNECT_LINK
Skip to content

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
class AsyncOpenAQ(BaseClient):
    """OpenAQ asynchronous client.

    Args:
        api_key: The API key for accessing the service.
        user_agent: The user agent string to be used in requests.
        headers: Additional headers to be sent with the request.
        base_url: The base URL for the API endpoint.

    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:
        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.

    """

    def __init__(
        self,
        api_key: Union[str, None] = None,
        headers: Mapping[str, str] = {},
        base_url: str = DEFAULT_BASE_URL,
        user_agent: str = DEFAULT_USER_AGENT,
        transport: AsyncTransport = AsyncTransport(),
    ) -> AsyncOpenAQ:
        super().__init__(transport, user_agent, headers, api_key, base_url)

        self.countries = Countries(self)
        self.instruments = Instruments(self)
        self.licenses = Licenses(self)
        self.locations = Locations(self)
        self.manufacturers = Manufacturers(self)
        self.measurements = Measurements(self)
        self.owners = Owners(self)
        self.providers = Providers(self)
        self.parameters = Parameters(self)
        self.sensors = Sensors(self)

    @property
    def transport(self) -> AsyncTransport:
        return self._transport

    async def _do(
        self,
        method: str,
        path: str,
        *,
        params: Union[Mapping[str, Any], None] = None,
        headers: Union[Mapping[str, str], None] = None,
    ):
        request_headers = self.build_request_headers(headers)
        try:
            url = self._base_url + path
            data = await self.transport.send_request(
                method=method, url=url, params=params, headers=request_headers
            )
            return data
        except Exception as e:
            raise e

    async def _get(
        self,
        path: str,
        *,
        params: Union[Mapping[str, str], None] = None,
        headers: Union[Mapping[str, Any], None] = None,
    ):
        return await self._do("get", path, params=params, headers=headers)

    async def close(self):
        await self._transport.close()

    async def __aenter__(self) -> AsyncOpenAQ:
        return self

    async def __aexit__(self, *_: Any):
        await self.close()

Locations

This provides methods to retrieve air monitor locations resource from the OpenAQ API.

Source code in openaq/_async/models/locations.py
class Locations(AsyncResourceBase):
    """This provides methods to retrieve air monitor locations resource from the OpenAQ API."""

    async def get(self, locations_id: int) -> LocationsResponse:
        """Retrieve a specific location by its locations ID.

        Args:
            locations_id: The locations ID of the location to retrieve.

        Returns:
            LocationsResponse: An instance representing the retrieved location.

        Raises:
            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.
        """
        location = await self._client._get(f"/locations/{locations_id}")
        return LocationsResponse.read_response(location)

    async def latest(self, locations_id: int) -> LatestResponse:
        """Retrieve latest measurements from a location.

        Args:
            locations_id: The locations ID of the location to retrieve.

        Returns:
            LatestResponse: An instance representing the retrieved latest results.

        Raises:
            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.
        """
        latest = await self._client._get(f"/locations/{locations_id}/latest")
        return LatestResponse.read_response(latest)

    async def list(
        self,
        page: int = 1,
        limit: int = 100,
        radius: Union[int, None] = None,
        coordinates: Union[Tuple[float, float], None] = None,
        bbox: Union[Tuple[float, float, float, float], None] = None,
        providers_id: Union[int, List[int], None] = None,
        countries_id: Union[int, List[int], None] = None,
        parameters_id: Union[int, List[int], None] = None,
        licenses_id: Union[int, List[int], None] = None,
        iso: Union[str, None] = None,
        monitor: Union[bool, None] = None,
        mobile: Union[bool, None] = None,
        order_by: Union[str, None] = None,
        sort_order: Union[str, None] = None,
    ) -> LocationsResponse:
        """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 retrieve
        * `limit` - Sets the number of results generated per page
        * `radius` - Specifies the distance around a central point, filtering locations within a circular area. Must be used with `coordinates`, cannot be used in combination with `bbox`
        * `coordinates` - Filters locations by coordinates. Must be used with `radius`, cannot be used in combination with `bbox`
        * `bbox` - Filters locations using a bounding box. Cannot be used with `coordinates` or `radius`
        * `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 code
        * `monitor` - Filters results by reference grade monitors (`true`), air sensors (`false`), or both if not used
        * `mobile` - Filters results for mobile sensors (`true`), non-mobile sensors (`false`), or both if not used
        * `order_by` - Determines the fields by which results are sorted; available values are `id`
        * `sort_order` - Works in tandem with `order_by` to specify the direction: either `asc` (ascending) or `desc` (descending)

        Args:
            page: The page number. Page count is locations found / limit.
            limit: The number of results returned per page.
            radius: A distance value in meters to search around the given coordinates value.
            coordinates: WGS 84 coordinate pair in form latitude, longitude (y,x).
            bbox: Geospatial bounding box of min X, min Y, max X, max Y in WGS 84 coordinates. Limited to four decimals precision.
            providers_id: Single providers ID or an array of IDs.
            countries_id: Single countries ID or an array of IDs.
            parameters_id: Single parameters ID or an array of IDs.
            licenses_id: Single licenses ID or an array of IDs.
            iso: 2 letter ISO 3166-alpha-2 country code.
            monitor: Boolean for reference grade monitors (true) or air sensors (false)
            mobile: Boolean mobile locations (true) or not mobile locations (false).
            order_by: Order by operators for results.
            sort_order: Sort order (asc/desc).

        Returns:
            LocationsResponse: An instance representing the list of retrieved locations.

        Raises:
            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.
        """
        params = build_query_params(
            page=page,
            limit=limit,
            radius=radius,
            coordinates=coordinates,
            bbox=bbox,
            providers_id=providers_id,
            countries_id=countries_id,
            parameters_id=parameters_id,
            licenses_id=licenses_id,
            iso=iso,
            monitor=monitor,
            mobile=mobile,
            order_by=order_by,
            sort_order=sort_order,
        )

        locations = await self._client._get("/locations", params=params)
        return LocationsResponse.read_response(locations)

    async def sensors(self, locations_id: int) -> SensorsResponse:
        """Retrieve sensors from a location.

        Args:
            locations_id: The locations ID of the location to retrieve.

        Returns:
            SensorsResponse: An instance representing the retrieved latest results.

        Raises:
            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.
        """
        sensors = await self._client._get(f"/locations/{locations_id}/sensors")
        return SensorsResponse.read_response(sensors)

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
async def get(self, locations_id: int) -> LocationsResponse:
    """Retrieve a specific location by its locations ID.

    Args:
        locations_id: The locations ID of the location to retrieve.

    Returns:
        LocationsResponse: An instance representing the retrieved location.

    Raises:
        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.
    """
    location = await self._client._get(f"/locations/{locations_id}")
    return LocationsResponse.read_response(location)

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
async def latest(self, locations_id: int) -> LatestResponse:
    """Retrieve latest measurements from a location.

    Args:
        locations_id: The locations ID of the location to retrieve.

    Returns:
        LatestResponse: An instance representing the retrieved latest results.

    Raises:
        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.
    """
    latest = await self._client._get(f"/locations/{locations_id}/latest")
    return LatestResponse.read_response(latest)

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 retrieve
  • limit - Sets the number of results generated per page
  • radius - Specifies the distance around a central point, filtering locations within a circular area. Must be used with coordinates, cannot be used in combination with bbox
  • coordinates - Filters locations by coordinates. Must be used with radius, cannot be used in combination with bbox
  • bbox - Filters locations using a bounding box. Cannot be used with coordinates or radius
  • 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 code
  • monitor - Filters results by reference grade monitors (true), air sensors (false), or both if not used
  • mobile - Filters results for mobile sensors (true), non-mobile sensors (false), or both if not used
  • order_by - Determines the fields by which results are sorted; available values are id
  • sort_order - Works in tandem with order_by to specify the direction: either asc (ascending) or desc (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
async def list(
    self,
    page: int = 1,
    limit: int = 100,
    radius: Union[int, None] = None,
    coordinates: Union[Tuple[float, float], None] = None,
    bbox: Union[Tuple[float, float, float, float], None] = None,
    providers_id: Union[int, List[int], None] = None,
    countries_id: Union[int, List[int], None] = None,
    parameters_id: Union[int, List[int], None] = None,
    licenses_id: Union[int, List[int], None] = None,
    iso: Union[str, None] = None,
    monitor: Union[bool, None] = None,
    mobile: Union[bool, None] = None,
    order_by: Union[str, None] = None,
    sort_order: Union[str, None] = None,
) -> LocationsResponse:
    """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 retrieve
    * `limit` - Sets the number of results generated per page
    * `radius` - Specifies the distance around a central point, filtering locations within a circular area. Must be used with `coordinates`, cannot be used in combination with `bbox`
    * `coordinates` - Filters locations by coordinates. Must be used with `radius`, cannot be used in combination with `bbox`
    * `bbox` - Filters locations using a bounding box. Cannot be used with `coordinates` or `radius`
    * `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 code
    * `monitor` - Filters results by reference grade monitors (`true`), air sensors (`false`), or both if not used
    * `mobile` - Filters results for mobile sensors (`true`), non-mobile sensors (`false`), or both if not used
    * `order_by` - Determines the fields by which results are sorted; available values are `id`
    * `sort_order` - Works in tandem with `order_by` to specify the direction: either `asc` (ascending) or `desc` (descending)

    Args:
        page: The page number. Page count is locations found / limit.
        limit: The number of results returned per page.
        radius: A distance value in meters to search around the given coordinates value.
        coordinates: WGS 84 coordinate pair in form latitude, longitude (y,x).
        bbox: Geospatial bounding box of min X, min Y, max X, max Y in WGS 84 coordinates. Limited to four decimals precision.
        providers_id: Single providers ID or an array of IDs.
        countries_id: Single countries ID or an array of IDs.
        parameters_id: Single parameters ID or an array of IDs.
        licenses_id: Single licenses ID or an array of IDs.
        iso: 2 letter ISO 3166-alpha-2 country code.
        monitor: Boolean for reference grade monitors (true) or air sensors (false)
        mobile: Boolean mobile locations (true) or not mobile locations (false).
        order_by: Order by operators for results.
        sort_order: Sort order (asc/desc).

    Returns:
        LocationsResponse: An instance representing the list of retrieved locations.

    Raises:
        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.
    """
    params = build_query_params(
        page=page,
        limit=limit,
        radius=radius,
        coordinates=coordinates,
        bbox=bbox,
        providers_id=providers_id,
        countries_id=countries_id,
        parameters_id=parameters_id,
        licenses_id=licenses_id,
        iso=iso,
        monitor=monitor,
        mobile=mobile,
        order_by=order_by,
        sort_order=sort_order,
    )

    locations = await self._client._get("/locations", params=params)
    return LocationsResponse.read_response(locations)

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
async def sensors(self, locations_id: int) -> SensorsResponse:
    """Retrieve sensors from a location.

    Args:
        locations_id: The locations ID of the location to retrieve.

    Returns:
        SensorsResponse: An instance representing the retrieved latest results.

    Raises:
        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.
    """
    sensors = await self._client._get(f"/locations/{locations_id}/sensors")
    return SensorsResponse.read_response(sensors)

Measurements

This provides methods to retrieve and list the air quality measurements from the OpenAQ API.

Source code in openaq/_async/models/measurements.py
class Measurements(AsyncResourceBase):
    """This provides methods to retrieve and list the air quality measurements from the OpenAQ API."""

    async def list(
        self,
        sensors_id: int,
        data: Union[Data, None] = None,
        rollup: Union[Rollup, None] = None,
        date_from: Union[datetime.datetime, str, None] = "2016-10-10",
        date_to: Union[datetime.datetime, str, None] = None,
        page: int = 1,
        limit: int = 1000,
    ) -> MeasurementsResponse:
        """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 retrieval
        * `date_to` - Declare an end time or data retrieval
        * `page` - Specifies the page number of results to retrieve
        * `limit` - Sets the number of results generated per page

        Args:
            sensors_id: The ID of the sensor for which measurements should be retrieved.
            data: The base measurement unit to query
            rollup: The period by which to rollup the base measurement data.
            date_from: Starting date for the measurement retrieval. Can be a datetime object or ISO-8601 formatted date or datetime string.
            date_to: Ending date for the measurement retrieval. Can be a datetime object or ISO-8601 formatted date or datetime string.
            page: The page number to fetch. Page count is determined by total measurements found divided by the limit.
            limit: The number of results returned per page.

        Returns:
            MeasurementsResponse: An instance representing the list of retrieved air quality measurements.

        Raises:
            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.
        """
        params = build_query_params(
            page=page, limit=limit, date_from=date_from, date_to=date_to
        )
        path = build_measurements_path(sensors_id, data, rollup)

        measurements = await self._client._get(path, params=params)
        return MeasurementsResponse.read_response(measurements)

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 retrieval
  • date_to - Declare an end time or data retrieval
  • page - Specifies the page number of results to retrieve
  • limit - 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
async def list(
    self,
    sensors_id: int,
    data: Union[Data, None] = None,
    rollup: Union[Rollup, None] = None,
    date_from: Union[datetime.datetime, str, None] = "2016-10-10",
    date_to: Union[datetime.datetime, str, None] = None,
    page: int = 1,
    limit: int = 1000,
) -> MeasurementsResponse:
    """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 retrieval
    * `date_to` - Declare an end time or data retrieval
    * `page` - Specifies the page number of results to retrieve
    * `limit` - Sets the number of results generated per page

    Args:
        sensors_id: The ID of the sensor for which measurements should be retrieved.
        data: The base measurement unit to query
        rollup: The period by which to rollup the base measurement data.
        date_from: Starting date for the measurement retrieval. Can be a datetime object or ISO-8601 formatted date or datetime string.
        date_to: Ending date for the measurement retrieval. Can be a datetime object or ISO-8601 formatted date or datetime string.
        page: The page number to fetch. Page count is determined by total measurements found divided by the limit.
        limit: The number of results returned per page.

    Returns:
        MeasurementsResponse: An instance representing the list of retrieved air quality measurements.

    Raises:
        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.
    """
    params = build_query_params(
        page=page, limit=limit, date_from=date_from, date_to=date_to
    )
    path = build_measurements_path(sensors_id, data, rollup)

    measurements = await self._client._get(path, params=params)
    return MeasurementsResponse.read_response(measurements)

Countries

This provides methods to retrieve country data from the OpenAQ API.

Source code in openaq/_async/models/countries.py
class Countries(AsyncResourceBase):
    """This provides methods to retrieve country data from the OpenAQ API."""

    async def get(self, countries_id: int) -> CountriesResponse:
        """Retrieve specific country data by its countries ID.

        Args:
            countries_id: The countries ID of the country to retrieve.

        Returns:
            CountriesResponse: An instance representing the retrieved country.

        Raises:
            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.
        """
        country = await self._client._get(f"/countries/{countries_id}")
        return CountriesResponse.read_response(country)

    async def list(
        self,
        page: int = 1,
        limit: int = 1000,
        order_by: str = None,
        sort_order: str = None,
        parameters_id: int = None,
        providers_id: int = None,
    ) -> CountriesResponse:
        """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 retrieve
        * `limit` - Sets the number of results generated per page
        * `providers_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 are `id`
        * `sort_order` - Works in tandem with `order_by` to specify the direction: either `asc` (ascending) or `desc` (descending)

        Args:
            page: The page number. Page count is countries found / limit.
            limit: The number of results returned per page.
            order_by: Order by operators for results.
            sort_order: Sort order (asc/desc).
            parameters_id: Single parameters ID or an array of IDs.
            providers_id: Single providers ID or an array of IDs.

        Returns:
            CountriesResponse: An instance representing the list of retrieved countries.

        Raises:
            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.
        """
        params = build_query_params(
            page=page,
            limit=limit,
            order_by=order_by,
            sort_order=sort_order,
            parameters_id=parameters_id,
            providers_id=providers_id,
        )

        countries = await self._client._get("/countries", params=params)
        return CountriesResponse.read_response(countries)

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
async def get(self, countries_id: int) -> CountriesResponse:
    """Retrieve specific country data by its countries ID.

    Args:
        countries_id: The countries ID of the country to retrieve.

    Returns:
        CountriesResponse: An instance representing the retrieved country.

    Raises:
        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.
    """
    country = await self._client._get(f"/countries/{countries_id}")
    return CountriesResponse.read_response(country)

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 retrieve
  • limit - Sets the number of results generated per page
  • providers_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 are id
  • sort_order - Works in tandem with order_by to specify the direction: either asc (ascending) or desc (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
async def list(
    self,
    page: int = 1,
    limit: int = 1000,
    order_by: str = None,
    sort_order: str = None,
    parameters_id: int = None,
    providers_id: int = None,
) -> CountriesResponse:
    """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 retrieve
    * `limit` - Sets the number of results generated per page
    * `providers_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 are `id`
    * `sort_order` - Works in tandem with `order_by` to specify the direction: either `asc` (ascending) or `desc` (descending)

    Args:
        page: The page number. Page count is countries found / limit.
        limit: The number of results returned per page.
        order_by: Order by operators for results.
        sort_order: Sort order (asc/desc).
        parameters_id: Single parameters ID or an array of IDs.
        providers_id: Single providers ID or an array of IDs.

    Returns:
        CountriesResponse: An instance representing the list of retrieved countries.

    Raises:
        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.
    """
    params = build_query_params(
        page=page,
        limit=limit,
        order_by=order_by,
        sort_order=sort_order,
        parameters_id=parameters_id,
        providers_id=providers_id,
    )

    countries = await self._client._get("/countries", params=params)
    return CountriesResponse.read_response(countries)

Instruments

This provides methods to retrieve instrument data from the OpenAQ API.

Source code in openaq/_async/models/instruments.py
class Instruments(AsyncResourceBase):
    """This provides methods to retrieve instrument data from the OpenAQ API."""

    async def get(self, providers_id: int) -> InstrumentsResponse:
        """Retrieve specific instrument data by its providers ID.

        Args:
            providers_id: The providers ID of the instrument to retrieve.

        Returns:
            InstrumentsResponse: An instance representing the retrieved instrument.

        Raises:
            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.
        """
        instrument = await self._client._get(f"/instruments/{providers_id}")
        return InstrumentsResponse.read_response(instrument)

    async def list(
        self,
        page: int = 1,
        limit: int = 1000,
        order_by: str = None,
        sort_order: str = None,
    ) -> InstrumentsResponse:
        """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 page
        * `order_by` - Determines the fields by which results are sorted; available values are `id`
        * `sort_order` - Works in tandem with `order_by` to specify the direction: either `asc` (ascending) or `desc` (descending)

        Args:
            page: The page number. Page count is instruments found / limit.
            limit: The number of results returned per page.
            order_by: Order by operators for results.
            sort_order: Sort order (asc/desc).

        Returns:
            InstrumentsResponse: An instance representing the list of retrieved instruments.

        Raises:
            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.
        """
        params = build_query_params(
            page=page, limit=limit, order_by=order_by, sort_order=sort_order
        )

        instruments = await self._client._get("/instruments", params=params)
        return InstrumentsResponse.read_response(instruments)

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
async def get(self, providers_id: int) -> InstrumentsResponse:
    """Retrieve specific instrument data by its providers ID.

    Args:
        providers_id: The providers ID of the instrument to retrieve.

    Returns:
        InstrumentsResponse: An instance representing the retrieved instrument.

    Raises:
        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.
    """
    instrument = await self._client._get(f"/instruments/{providers_id}")
    return InstrumentsResponse.read_response(instrument)

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 page
  • order_by - Determines the fields by which results are sorted; available values are id
  • sort_order - Works in tandem with order_by to specify the direction: either asc (ascending) or desc (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
async def list(
    self,
    page: int = 1,
    limit: int = 1000,
    order_by: str = None,
    sort_order: str = None,
) -> InstrumentsResponse:
    """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 page
    * `order_by` - Determines the fields by which results are sorted; available values are `id`
    * `sort_order` - Works in tandem with `order_by` to specify the direction: either `asc` (ascending) or `desc` (descending)

    Args:
        page: The page number. Page count is instruments found / limit.
        limit: The number of results returned per page.
        order_by: Order by operators for results.
        sort_order: Sort order (asc/desc).

    Returns:
        InstrumentsResponse: An instance representing the list of retrieved instruments.

    Raises:
        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.
    """
    params = build_query_params(
        page=page, limit=limit, order_by=order_by, sort_order=sort_order
    )

    instruments = await self._client._get("/instruments", params=params)
    return InstrumentsResponse.read_response(instruments)

Licenses

This provides methods to retrieve air monitor locations resource from the OpenAQ API.

Source code in openaq/_async/models/licenses.py
class Licenses(AsyncResourceBase):
    """This provides methods to retrieve air monitor locations resource from the OpenAQ API."""

    async def get(self, licenses_id: int) -> LicensesResponse:
        """Retrieve a specific license by its licenses ID.

        Args:
            licenses_id: The licenses ID of the license to retrieve.

        Returns:
            LicensesReponse: An instance representing the retrieved license.

        Raises:
            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.
        """
        license = await self._client._get(f"/licenses/{licenses_id}")
        return LicensesResponse.read_response(license)

    async def list(
        self,
        page: int = 1,
        limit: int = 1000,
        order_by: Union[str, None] = None,
        sort_order: Union[str, None] = None,
    ) -> LicensesResponse:
        """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 retrieve
        * `limit` - Sets the number of results generated per page
        * `order_by` - Determines the fields by which results are sorted; available values are `id`
        * `sort_order` - Works in tandem with `order_by` to specify the direction: either `asc` (ascending) or `desc` (descending)

        Args:
            page: The page number. Page count is locations found / limit.
            limit: The number of results returned per page.
            order_by: Order by operators for results.
            sort_order: Sort order (asc/desc).

        Returns:
            LicensesReponse: An instance representing the list of retrieved licenses.

        Raises:
            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.
        """
        params = build_query_params(
            page=page,
            limit=limit,
            order_by=order_by,
            sort_order=sort_order,
        )

        licenses = await self._client._get("/licenses", params=params)
        return LicensesResponse.read_response(licenses)

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
async def get(self, licenses_id: int) -> LicensesResponse:
    """Retrieve a specific license by its licenses ID.

    Args:
        licenses_id: The licenses ID of the license to retrieve.

    Returns:
        LicensesReponse: An instance representing the retrieved license.

    Raises:
        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.
    """
    license = await self._client._get(f"/licenses/{licenses_id}")
    return LicensesResponse.read_response(license)

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 retrieve
  • limit - Sets the number of results generated per page
  • order_by - Determines the fields by which results are sorted; available values are id
  • sort_order - Works in tandem with order_by to specify the direction: either asc (ascending) or desc (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
async def list(
    self,
    page: int = 1,
    limit: int = 1000,
    order_by: Union[str, None] = None,
    sort_order: Union[str, None] = None,
) -> LicensesResponse:
    """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 retrieve
    * `limit` - Sets the number of results generated per page
    * `order_by` - Determines the fields by which results are sorted; available values are `id`
    * `sort_order` - Works in tandem with `order_by` to specify the direction: either `asc` (ascending) or `desc` (descending)

    Args:
        page: The page number. Page count is locations found / limit.
        limit: The number of results returned per page.
        order_by: Order by operators for results.
        sort_order: Sort order (asc/desc).

    Returns:
        LicensesReponse: An instance representing the list of retrieved licenses.

    Raises:
        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.
    """
    params = build_query_params(
        page=page,
        limit=limit,
        order_by=order_by,
        sort_order=sort_order,
    )

    licenses = await self._client._get("/licenses", params=params)
    return LicensesResponse.read_response(licenses)

Manufacturers

This provides methods to retrieve manufacturer data from the OpenAQ API.

Source code in openaq/_async/models/manufacturers.py
class Manufacturers(AsyncResourceBase):
    """This provides methods to retrieve manufacturer data from the OpenAQ API."""

    async def get(self, manufacturers_id: int) -> ManufacturersResponse:
        """Retrieve specific manufacturer data by its manufacturers ID.

        Args:
            manufacturers_id: The manufacturers ID of the manufacturer to retrieve.

        Returns:
            ManufacturersResponse: An instance representing the retrieved manufacturer.

        Raises:
            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.
        """
        manufacturer = await self._client._get(f"/manufacturers/{manufacturers_id}")
        return ManufacturersResponse.read_response(manufacturer)

    async def list(
        self,
        page: int = 1,
        limit: int = 1000,
        order_by: str = None,
        sort_order: str = None,
    ) -> ManufacturersResponse:
        """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 retrieve
        * `limit` - Sets the number of results generated per page
        * `order_by` - Determines the fields by which results are sorted; available values are `id`
        * `sort_order` - Works in tandem with `order_by` to specify the direction: either `asc` (ascending) or `desc` (descending)

        Args:
            page: The page number. Page count is manufacturers found / limit.
            limit: The number of results returned per page.
            order_by: Order by operators for results.
            sort_order: Sort order (asc/desc).

        Returns:
            ManufacturersResponse: An instance representing the list of retrieved manufacturers.

        Raises:
            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.
        """
        params = build_query_params(
            page=page, limit=limit, order_by=order_by, sort_order=sort_order
        )

        manufacturers = await self._client._get("/manufacturers", params=params)
        return ManufacturersResponse.read_response(manufacturers)

    async def instruments(self, manufacturers_id: int) -> InstrumentsResponse:
        """Retrieve instruments of a manufacturer by ID.

        Args:
            manufacturers_id: The manufacturers ID of the manufacturer to retrieve.

        Returns:
            InstrumentsResponse: An instance representing the retrieved instruments.

        Raises:
            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.
        """
        instruments_response = await self._client._get(
            f"/manufacturers/{manufacturers_id}/instruments"
        )
        return InstrumentsResponse.read_response(instruments_response)

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
async def get(self, manufacturers_id: int) -> ManufacturersResponse:
    """Retrieve specific manufacturer data by its manufacturers ID.

    Args:
        manufacturers_id: The manufacturers ID of the manufacturer to retrieve.

    Returns:
        ManufacturersResponse: An instance representing the retrieved manufacturer.

    Raises:
        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.
    """
    manufacturer = await self._client._get(f"/manufacturers/{manufacturers_id}")
    return ManufacturersResponse.read_response(manufacturer)

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
async def instruments(self, manufacturers_id: int) -> InstrumentsResponse:
    """Retrieve instruments of a manufacturer by ID.

    Args:
        manufacturers_id: The manufacturers ID of the manufacturer to retrieve.

    Returns:
        InstrumentsResponse: An instance representing the retrieved instruments.

    Raises:
        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.
    """
    instruments_response = await self._client._get(
        f"/manufacturers/{manufacturers_id}/instruments"
    )
    return InstrumentsResponse.read_response(instruments_response)

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 retrieve
  • limit - Sets the number of results generated per page
  • order_by - Determines the fields by which results are sorted; available values are id
  • sort_order - Works in tandem with order_by to specify the direction: either asc (ascending) or desc (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
async def list(
    self,
    page: int = 1,
    limit: int = 1000,
    order_by: str = None,
    sort_order: str = None,
) -> ManufacturersResponse:
    """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 retrieve
    * `limit` - Sets the number of results generated per page
    * `order_by` - Determines the fields by which results are sorted; available values are `id`
    * `sort_order` - Works in tandem with `order_by` to specify the direction: either `asc` (ascending) or `desc` (descending)

    Args:
        page: The page number. Page count is manufacturers found / limit.
        limit: The number of results returned per page.
        order_by: Order by operators for results.
        sort_order: Sort order (asc/desc).

    Returns:
        ManufacturersResponse: An instance representing the list of retrieved manufacturers.

    Raises:
        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.
    """
    params = build_query_params(
        page=page, limit=limit, order_by=order_by, sort_order=sort_order
    )

    manufacturers = await self._client._get("/manufacturers", params=params)
    return ManufacturersResponse.read_response(manufacturers)

Owners

This provides methods to retrieve owner data from the OpenAQ API.

Source code in openaq/_async/models/owners.py
class Owners(AsyncResourceBase):
    """This provides methods to retrieve owner data from the OpenAQ API."""

    async def get(self, owners_id: int) -> OwnersResponse:
        """Retrieve specific owner data by its owners ID.

        Args:
            owners_id: The owners ID of the owner to retrieve.

        Returns:
            OwnersResponse: An instance representing the retrieved owner.

        Raises:
            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.
        """
        owner = await self._client._get(f"/owners/{owners_id}")
        return OwnersResponse.read_response(owner)

    async def list(
        self,
        page: int = 1,
        limit: int = 1000,
        order_by: str = None,
        sort_order: str = None,
    ) -> OwnersResponse:
        """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 retrieve
        * `limit` - Sets the number of results generated per page
        * `order_by` - Determines the fields by which results are sorted; available values are `id`
        * `sort_order` - Works in tandem with `order_by` to specify the direction: either `asc` (ascending) or `desc` (descending)

        Args:
            page: The page number. Page count is owners found / limit.
            limit: The number of results returned per page.
            order_by: Order by operators for results.
            sort_order: Sort order (asc/desc).

        Returns:
            OwnersResponse: An instance representing the list of retrieved owners.

        Raises:
            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.
        """
        params = build_query_params(
            page=page, limit=limit, order_by=order_by, sort_order=sort_order
        )

        owners = await self._client._get("/owners", params=params)
        return OwnersResponse.read_response(owners)

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
async def get(self, owners_id: int) -> OwnersResponse:
    """Retrieve specific owner data by its owners ID.

    Args:
        owners_id: The owners ID of the owner to retrieve.

    Returns:
        OwnersResponse: An instance representing the retrieved owner.

    Raises:
        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.
    """
    owner = await self._client._get(f"/owners/{owners_id}")
    return OwnersResponse.read_response(owner)

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 retrieve
  • limit - Sets the number of results generated per page
  • order_by - Determines the fields by which results are sorted; available values are id
  • sort_order - Works in tandem with order_by to specify the direction: either asc (ascending) or desc (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
async def list(
    self,
    page: int = 1,
    limit: int = 1000,
    order_by: str = None,
    sort_order: str = None,
) -> OwnersResponse:
    """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 retrieve
    * `limit` - Sets the number of results generated per page
    * `order_by` - Determines the fields by which results are sorted; available values are `id`
    * `sort_order` - Works in tandem with `order_by` to specify the direction: either `asc` (ascending) or `desc` (descending)

    Args:
        page: The page number. Page count is owners found / limit.
        limit: The number of results returned per page.
        order_by: Order by operators for results.
        sort_order: Sort order (asc/desc).

    Returns:
        OwnersResponse: An instance representing the list of retrieved owners.

    Raises:
        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.
    """
    params = build_query_params(
        page=page, limit=limit, order_by=order_by, sort_order=sort_order
    )

    owners = await self._client._get("/owners", params=params)
    return OwnersResponse.read_response(owners)

Parameters

This provides methods to retrieve parameter data from the OpenAQ API.

Source code in openaq/_async/models/parameters.py
class Parameters(AsyncResourceBase):
    """This provides methods to retrieve parameter data from the OpenAQ API."""

    async def get(self, parameters_id: int) -> ParametersResponse:
        """Retrieve specific parameter data by its parameters ID.

        Args:
            parameters_id: The parameters ID of the parameter to retrieve.

        Returns:
            ParametersResponse: An instance representing the retrieved parameter.

        Raises:
            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.
        """
        parameter = await self._client._get(f"/parameters/{parameters_id}")
        return ParametersResponse.read_response(parameter)

    async def list(
        self,
        page: int = 1,
        limit: int = 1000,
        order_by: str = None,
        sort_order: str = None,
        parameter_type: str = None,
        coordinates: tuple = None,
        radius: int = None,
        bbox: tuple = None,
        iso: str = None,
        countries_id: int = None,
    ) -> ParametersResponse:
        """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 retrieve
        * `limit` - Sets the number of results generated per page
        * `parameter_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 with `coordinates` and not with `bbox`
        * `coordinates` - Filters locations by coordinates. Must be used with `radius`, cannot be used in combination with `bbox`
        * `bbox` - Filters locations using a bounding box. Cannot be used with `coordinates` or `radius`
        * `iso` - Filters results by selected country code
        * `countries_id` - Filters results by selected countries ID(s)
        * `order_by` - Determines the fields by which results are sorted; available values are `id`
        * `sort_order` - Works in tandem with `order_by` to specify the direction: either `asc` (ascending) or `desc` (descending)

        Args:
            page: The page number. Page count is parameters found / limit.
            limit: The number of results returned per page.
            parameter_type: pollutant or meteorological.
            radius: A distance value in meters to search around the given coordinates value.
            coordinates: WGS 84 coordinate pair in form latitude, longitude (y,x).
            bbox: Geospatial bounding box of min X, min Y, max X, max Y in WGS 84 coordinates. Limited to four decimals precision.
            iso:  2 letter ISO 3166-alpha-2 country code.
            countries_id: Single countries ID or an array of IDs.
            order_by: Order by operators for results.
            sort_order: Sort order (asc/desc).

        Returns:
            ParametersResponse: An instance representing the list of retrieved parameters.

        Raises:
            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.
        """
        params = build_query_params(
            page=page,
            limit=limit,
            order_by=order_by,
            sort_order=sort_order,
            parameter_type=parameter_type,
            coordinates=coordinates,
            radius=radius,
            bbox=bbox,
            iso=iso,
            countries_id=countries_id,
        )

        parameters = await self._client._get("/parameters", params=params)
        return ParametersResponse.read_response(parameters)

    async def latest(self, parameters_id: int) -> LatestResponse:
        """Retrieve latest measurements from a location.

        Args:
            parameters_id: The locations ID of the location to retrieve.

        Returns:
            LatestResponse: An instance representing the retrieved latest results.

        Raises:
            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.
        """
        latest = await self._client._get(f"/parameters/{parameters_id}/latest")
        return LatestResponse.read_response(latest)

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
async def get(self, parameters_id: int) -> ParametersResponse:
    """Retrieve specific parameter data by its parameters ID.

    Args:
        parameters_id: The parameters ID of the parameter to retrieve.

    Returns:
        ParametersResponse: An instance representing the retrieved parameter.

    Raises:
        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.
    """
    parameter = await self._client._get(f"/parameters/{parameters_id}")
    return ParametersResponse.read_response(parameter)

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
async def latest(self, parameters_id: int) -> LatestResponse:
    """Retrieve latest measurements from a location.

    Args:
        parameters_id: The locations ID of the location to retrieve.

    Returns:
        LatestResponse: An instance representing the retrieved latest results.

    Raises:
        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.
    """
    latest = await self._client._get(f"/parameters/{parameters_id}/latest")
    return LatestResponse.read_response(latest)

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 retrieve
  • limit - Sets the number of results generated per page
  • parameter_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 with coordinates and not with bbox
  • coordinates - Filters locations by coordinates. Must be used with radius, cannot be used in combination with bbox
  • bbox - Filters locations using a bounding box. Cannot be used with coordinates or radius
  • iso - Filters results by selected country code
  • countries_id - Filters results by selected countries ID(s)
  • order_by - Determines the fields by which results are sorted; available values are id
  • sort_order - Works in tandem with order_by to specify the direction: either asc (ascending) or desc (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
async def list(
    self,
    page: int = 1,
    limit: int = 1000,
    order_by: str = None,
    sort_order: str = None,
    parameter_type: str = None,
    coordinates: tuple = None,
    radius: int = None,
    bbox: tuple = None,
    iso: str = None,
    countries_id: int = None,
) -> ParametersResponse:
    """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 retrieve
    * `limit` - Sets the number of results generated per page
    * `parameter_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 with `coordinates` and not with `bbox`
    * `coordinates` - Filters locations by coordinates. Must be used with `radius`, cannot be used in combination with `bbox`
    * `bbox` - Filters locations using a bounding box. Cannot be used with `coordinates` or `radius`
    * `iso` - Filters results by selected country code
    * `countries_id` - Filters results by selected countries ID(s)
    * `order_by` - Determines the fields by which results are sorted; available values are `id`
    * `sort_order` - Works in tandem with `order_by` to specify the direction: either `asc` (ascending) or `desc` (descending)

    Args:
        page: The page number. Page count is parameters found / limit.
        limit: The number of results returned per page.
        parameter_type: pollutant or meteorological.
        radius: A distance value in meters to search around the given coordinates value.
        coordinates: WGS 84 coordinate pair in form latitude, longitude (y,x).
        bbox: Geospatial bounding box of min X, min Y, max X, max Y in WGS 84 coordinates. Limited to four decimals precision.
        iso:  2 letter ISO 3166-alpha-2 country code.
        countries_id: Single countries ID or an array of IDs.
        order_by: Order by operators for results.
        sort_order: Sort order (asc/desc).

    Returns:
        ParametersResponse: An instance representing the list of retrieved parameters.

    Raises:
        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.
    """
    params = build_query_params(
        page=page,
        limit=limit,
        order_by=order_by,
        sort_order=sort_order,
        parameter_type=parameter_type,
        coordinates=coordinates,
        radius=radius,
        bbox=bbox,
        iso=iso,
        countries_id=countries_id,
    )

    parameters = await self._client._get("/parameters", params=params)
    return ParametersResponse.read_response(parameters)

Providers

This provides methods to retrieve provider data from the OpenAQ API.

Source code in openaq/_async/models/providers.py
class Providers(AsyncResourceBase):
    """This provides methods to retrieve provider data from the OpenAQ API."""

    async def get(self, providers_id: int) -> ProvidersResponse:
        """Retrieve specific provider data by its providers ID.

        Args:
            providers_id: The providers ID of the provider to retrieve.

        Returns:
            ProvidersResponse: An instance representing the retrieved provider.

        Raises:
            See the 'Raises' section of the 'list' method for potential exceptions.
        """
        provider = await self._client._get(f"/providers/{providers_id}")
        return ProvidersResponse.read_response(provider)

    async def list(
        self,
        page: int = 1,
        limit: int = 1000,
        order_by: str = None,
        sort_order: str = None,
        parameters_id: int = None,
        monitor: bool = None,
        coordinates: tuple = None,
        radius: int = None,
        bbox: tuple = None,
        iso: str = None,
        countries_id: int = None,
    ) -> ProvidersResponse:
        """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 retrieve
        * `limit` - Sets the number of results generated per page
        * `parameters_id` - Filters results by selected parameters ID(s)
        * `monitor` - Filters results by reference grade monitors (`true`), air sensors (`false`), or both if not used
        * `radius` - Defines the distance around a given point to filter locations within that circular area. Always use with `coordinates` and not with `bbox`
        * `coordinates` - Filters locations by coordinates. Must be used with `radius`, cannot be used in combination with `bbox`
        * `bbox` - Filters locations using a bounding box. Cannot be used with `coordinates` or `radius`
        * `iso` - Filters results by selected country code
        * `countries_id` - Filter results by selected countries ID(s)
        * `order_by` - Determines the fields by which results are sorted; available values are `id`
        * `sort_order` - Works in tandem with `order_by` to specify the direction: either `asc` (ascending) or `desc` (descending)

        Args:
            page: The page number. Page count is providers found / limit.
            limit: The number of results returned per page.
            parameters_id: Single parameters ID or an array of IDs.
            monitor: Boolean for reference grade monitors (true) or air sensors (false).
            radius: A distance value in meters to search around the given coordinates value.
            coordinates: WGS 84 coordinate pair in form latitude, longitude (y,x).
            bbox: Geospatial bounding box of min X, min Y, max X, max Y in WGS 84 coordinates. Limited to four decimals precision.
            iso:  2 letter ISO 3166-alpha-2 country code.
            countries_id: Single countries ID or an array of IDs.
            order_by: Order by operators for results.
            sort_order: Sort order (asc/desc).

        Returns:
            ProvidersResponse: An instance representing the list of retrieved providers.

        Raises:
            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.
        """
        params = build_query_params(
            page=page,
            limit=limit,
            order_by=order_by,
            sort_order=sort_order,
            parameters_id=parameters_id,
            monitor=monitor,
            coordinates=coordinates,
            radius=radius,
            bbox=bbox,
            iso=iso,
            countries_id=countries_id,
        )

        providers = await self._client._get("/providers", params=params)
        return ProvidersResponse.read_response(providers)

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
async def get(self, providers_id: int) -> ProvidersResponse:
    """Retrieve specific provider data by its providers ID.

    Args:
        providers_id: The providers ID of the provider to retrieve.

    Returns:
        ProvidersResponse: An instance representing the retrieved provider.

    Raises:
        See the 'Raises' section of the 'list' method for potential exceptions.
    """
    provider = await self._client._get(f"/providers/{providers_id}")
    return ProvidersResponse.read_response(provider)

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 retrieve
  • limit - Sets the number of results generated per page
  • parameters_id - Filters results by selected parameters ID(s)
  • monitor - Filters results by reference grade monitors (true), air sensors (false), or both if not used
  • radius - Defines the distance around a given point to filter locations within that circular area. Always use with coordinates and not with bbox
  • coordinates - Filters locations by coordinates. Must be used with radius, cannot be used in combination with bbox
  • bbox - Filters locations using a bounding box. Cannot be used with coordinates or radius
  • iso - Filters results by selected country code
  • countries_id - Filter results by selected countries ID(s)
  • order_by - Determines the fields by which results are sorted; available values are id
  • sort_order - Works in tandem with order_by to specify the direction: either asc (ascending) or desc (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
async def list(
    self,
    page: int = 1,
    limit: int = 1000,
    order_by: str = None,
    sort_order: str = None,
    parameters_id: int = None,
    monitor: bool = None,
    coordinates: tuple = None,
    radius: int = None,
    bbox: tuple = None,
    iso: str = None,
    countries_id: int = None,
) -> ProvidersResponse:
    """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 retrieve
    * `limit` - Sets the number of results generated per page
    * `parameters_id` - Filters results by selected parameters ID(s)
    * `monitor` - Filters results by reference grade monitors (`true`), air sensors (`false`), or both if not used
    * `radius` - Defines the distance around a given point to filter locations within that circular area. Always use with `coordinates` and not with `bbox`
    * `coordinates` - Filters locations by coordinates. Must be used with `radius`, cannot be used in combination with `bbox`
    * `bbox` - Filters locations using a bounding box. Cannot be used with `coordinates` or `radius`
    * `iso` - Filters results by selected country code
    * `countries_id` - Filter results by selected countries ID(s)
    * `order_by` - Determines the fields by which results are sorted; available values are `id`
    * `sort_order` - Works in tandem with `order_by` to specify the direction: either `asc` (ascending) or `desc` (descending)

    Args:
        page: The page number. Page count is providers found / limit.
        limit: The number of results returned per page.
        parameters_id: Single parameters ID or an array of IDs.
        monitor: Boolean for reference grade monitors (true) or air sensors (false).
        radius: A distance value in meters to search around the given coordinates value.
        coordinates: WGS 84 coordinate pair in form latitude, longitude (y,x).
        bbox: Geospatial bounding box of min X, min Y, max X, max Y in WGS 84 coordinates. Limited to four decimals precision.
        iso:  2 letter ISO 3166-alpha-2 country code.
        countries_id: Single countries ID or an array of IDs.
        order_by: Order by operators for results.
        sort_order: Sort order (asc/desc).

    Returns:
        ProvidersResponse: An instance representing the list of retrieved providers.

    Raises:
        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.
    """
    params = build_query_params(
        page=page,
        limit=limit,
        order_by=order_by,
        sort_order=sort_order,
        parameters_id=parameters_id,
        monitor=monitor,
        coordinates=coordinates,
        radius=radius,
        bbox=bbox,
        iso=iso,
        countries_id=countries_id,
    )

    providers = await self._client._get("/providers", params=params)
    return ProvidersResponse.read_response(providers)

Sensors

This provides methods to retrieve sensor data from the OpenAQ API.

Source code in openaq/_async/models/sensors.py
class Sensors(AsyncResourceBase):
    """This provides methods to retrieve sensor data from the OpenAQ API."""

    async def get(self, sensors_id: int) -> SensorsResponse:
        """Retrieve specific sensor data by its sensors ID.

        Args:
            sensors_id: The sensors ID of the sensor to retrieve.

        Returns:
            SensorsResponse: An instance representing the retrieved sensor.

        Raises:
            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.
        """
        sensor_response = await self._client._get(f"/sensors/{sensors_id}")
        return SensorsResponse.read_response(sensor_response)

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.

Source code in openaq/_async/models/sensors.py
async def get(self, sensors_id: int) -> SensorsResponse:
    """Retrieve specific sensor data by its sensors ID.

    Args:
        sensors_id: The sensors ID of the sensor to retrieve.

    Returns:
        SensorsResponse: An instance representing the retrieved sensor.

    Raises:
        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.
    """
    sensor_response = await self._client._get(f"/sensors/{sensors_id}")
    return SensorsResponse.read_response(sensor_response)
$PRECONNECT_LINK $PRECONNECT_LINK
$PRECONNECT_LINK $PRECONNECT_LINK