Module Import alias Import alias ImportFrom alias ImportFrom alias ImportFrom alias Assign NameStore ListLoad Str Assign NameStore AttributeLoad Call NameLoad Str attr ClassDef bases NameLoad body Expr Str FunctionDef arguments args NameParam defaults kwarg body Assign AttributeStore NameLoad attr Call AttributeLoad NameLoad attr Str Str Assign AttributeStore NameLoad attr Call AttributeLoad NameLoad attr Str Str Assign AttributeStore NameLoad attr Call AttributeLoad NameLoad attr Str NameLoad Assign AttributeStore NameLoad attr Call AttributeLoad NameLoad attr Str NameLoad Assign AttributeStore NameLoad attr Dict Str Str decorator_list FunctionDef arguments args NameParam NameParam defaults kwarg body Expr Str Assign NameStore Call AttributeLoad Str attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr NameLoad Assign NameStore ListLoad For TupleStore NameStore NameStore Call AttributeLoad NameLoad attr body If Call NameLoad NameLoad NameLoad body Assign NameStore Call AttributeLoad Str attr NameLoad Expr Call AttributeLoad NameLoad attr Call AttributeLoad Str attr NameLoad NameLoad If CompareGt Call NameLoad NameLoad Num body Assign NameStore Call AttributeLoad Str attr ListLoad NameLoad Call AttributeLoad Str attr NameLoad Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults Str kwarg body Expr Str Assign NameStore TupleLoad AttributeLoad NameLoad attr AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad NameLoad attr NameLoad NameLoad If CompareEq NameLoad Str body TryExcept body Assign NameStore Call AttributeLoad NameLoad attr NameLoad keyword NameLoad keyword AttributeLoad NameLoad attr handlers ExceptHandler type NameLoad name NameStore body Raise Call NameLoad NameLoad orelse Raise Call NameLoad Str Return TupleLoad AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam NameParam defaults kwarg body Return Call AttributeLoad NameLoad attr NameLoad Str NameLoad decorator_list decorator_list ClassDef bases NameLoad body Expr Str FunctionDef arguments args NameParam NameParam defaults Str kwarg body Assign AttributeStore NameLoad attr Str Expr Call AttributeLoad Call NameLoad NameLoad NameLoad attr keyword NameLoad keyword AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam defaults kwarg body Expr Str Return Call AttributeLoad NameLoad attr Str NameLoad decorator_list Call NameLoad FunctionDef arguments args NameParam defaults kwarg body Expr Str Return Call AttributeLoad NameLoad attr Str NameLoad decorator_list Call NameLoad FunctionDef arguments args NameParam defaults kwarg body Expr Str Return Call AttributeLoad NameLoad attr Str NameLoad decorator_list Call NameLoad FunctionDef arguments args NameParam defaults kwarg body Expr Str Return Call AttributeLoad NameLoad attr Str NameLoad decorator_list Call NameLoad FunctionDef arguments args NameParam defaults kwarg body Expr Str Return Call AttributeLoad NameLoad attr Str NameLoad decorator_list Call NameLoad FunctionDef arguments args NameParam defaults kwarg body Expr Str Return Call AttributeLoad NameLoad attr Str NameLoad decorator_list FunctionDef arguments args NameParam defaults body Return Str decorator_list decorator_list
N/A N/A json N/A requests pkg_resources get_distribution exceptions ApiError decorators pandasize N/A __all__ N/A OpenAQ N/A __version__ N/A N/A get_distribution py-openaq version API N/A object N/A N/A Generic API wrapper object.
     __init__ N/A N/A self N/A kwargs N/A N/A N/A self _key N/A N/A kwargs pop key N/A N/A self _pswd N/A N/A kwargs pop pswd N/A N/A self _version N/A N/A kwargs pop version None N/A N/A self _baseurl N/A N/A kwargs pop baseurl None N/A N/A self _headers N/A content-type application/json N/A _make_url N/A N/A self endpoint N/A kwargs N/A N/A Internal method to create a url from an endpoint.

        :param endpoint: Endpoint for an API call

        :type endpoint: string

        :returns: url
         N/A endpoint N/A N/A {}/{}/{} format N/A self _baseurl N/A self _version endpoint N/A extra N/A N/A N/A key value N/A N/A kwargs items N/A N/A N/A isinstance value list N/A N/A value N/A N/A , join value N/A N/A N/A extra append N/A N/A {}={} format key value N/A N/A N/A len extra 0 N/A N/A endpoint N/A N/A ? join N/A endpoint N/A N/A & join extra N/A endpoint N/A _send N/A N/A self endpoint method N/A GET kwargs N/A N/A Make an API call of any method

        :param endpoint: API endpoint
        :param method: API call type. Options are PUT, POST, GET, DELETE

        :type endpoint: string
        :type method: string

        :returns: (status_code, json_response)

        :raises ApiError: raises an exception
         N/A auth N/A N/A self _key N/A self _pswd N/A url N/A N/A self _make_url endpoint kwargs N/A N/A method GET N/A N/A N/A N/A resp N/A N/A requests get url auth auth headers N/A self _headers N/A N/A N/A Exception N/A error N/A N/A N/A ApiError error N/A N/A N/A ApiError Invalid Method N/A N/A N/A resp status_code N/A N/A resp json N/A _get N/A N/A self url N/A kwargs N/A N/A N/A N/A self _send url GET kwargs N/A N/A OpenAQ N/A API N/A N/A Create an instance of the OpenAQ API

    :param version: API version.
    :param kwargs: API options.

    :type version: string
     __init__ N/A N/A self version N/A v1 kwargs N/A N/A N/A self _baseurl https://api.openaq.org N/A N/A N/A N/A super OpenAQ self __init__ version version baseurl N/A self _baseurl N/A cities N/A N/A self N/A kwargs N/A N/A Returns a listing of cities within the platform.

        :param country: limit results by a certain country
        :param df: convert the output from json to a pandas DataFrame

        :return: dictionary containing the *city*, *country*, *count*, and number of *locations*

        :type country: 2-digit ISO code
        :type df: boolean

        :Example:

        >>> import openaq
        >>> api = openaq.OpenAQ()
        >>> status, resp = api.cities()
        >>> resp
        [
            {
                "city": "Amsterdam",
                "country": "NL",
                "count": 21301,
                "locations": 14
            },
            {
                "city": "Badhoevedorp",
                "country": "NL",
                "count": 2326,
                "locations": 1
            },
            ...
        ]
         N/A N/A N/A self _get cities kwargs N/A N/A pandasize countries N/A N/A self N/A kwargs N/A N/A Returns a listing of all countries within the platform

        :param df: return the results as a pandas DataFrame

        :type df: boolean

        :return: dictionary containing the *code*, *name*, and *count*

        :Example:

        >>> import openaq
        >>> api = openaq.OpenAQ()
        >>> status, resp = api.countries()
        >>> resp
        [
            {
                "count": 40638,
                "code": "AU",
                "name": "Australia"
            },
            {
                "count": 78681,
                "code": "BR",
                "name": "Brazil",
            },
            ...
        ]
         N/A N/A N/A self _get countries kwargs N/A N/A pandasize latest N/A N/A self N/A kwargs N/A N/A Provides the latest value of each parameter for each location

        :param city: limit results by a certain city. Defaults to ``None``.
        :param country: limit results by a certain country. Should be a 2-digit
                        ISO country code. Defaults to ``None``.
        :param location: limit results by a city. Defaults to ``None``.
        :param parameter: limit results by a specific parameter. Options include [
                            pm25, pm10, so2, co, no2, o3, bc]
        :param has_geo: filter items that do or do not have geographic information.
        :param df: return results as a pandas DataFrame

        :type city: string
        :type country: string
        :type location: string
        :type parameter: string
        :type has_geo: boolean
        :type df: boolean

        :return: dictionary containing the *location*, *country*, *city*, and number of *measurements*

        :Example:

        >>> import openaq
        >>> api = openaq.OpenAQ()
        >>> status, resp = api.latest()
        >>> resp
        [
            {
                "location": "Punjabi Bagh",
                "city": "Delhi",
                "country": "IN",
                "measurements": [
                    {
                        "parameter": "so2",
                        "value": 7.8,
                        "unit": "ug/m3",
                        "lastUpdated": "2015-07-24T11:30:00.000Z"
                    },
                    {
                        "parameter": "co",
                        "value": 1.3,
                        "unit": "mg/m3",
                        "lastUpdated": "2015-07-24T11:30:00.000Z"
                    },
                    ...
                ]
                ...
            }
        ]
         N/A N/A N/A self _get latest kwargs N/A N/A pandasize locations N/A N/A self N/A kwargs N/A N/A Provides metadata about distinct measurement locations

        :param city: Limit results by a certain city. Defaults to ``None``.
        :param country: Limit results by a certain country. Should be a 2-digit
                        ISO country code. Defaults to ``None``.
        :param location: Limit results by a city. Defaults to ``None``.
        :param parameter: Limit results by a specific parameter. Options include [
                            pm25, pm10, so2, co, no2, o3, bc]
        :param has_geo: Filter items that do or do not have geographic information.

        :type city: string
        :type country: string
        :type location: string
        :type parameter: string
        :type has_geo: boolean

        :return: a dictionary containing the *loction*, *country*, *city*, *count*,
                    *sourceName*, *firstUpdated*, *lastUpdated*, *parameters*, and *coordinates*

        :Example:

        >>> import openaq
        >>> api = openaq.OpenAQ()
        >>> status, resp = api.locations()
        >>> resp
        [
            {
                "count": 4242,
                "sourceName": "Australia - New South Wales",
                "firstUpdated": "2015-07-24T11:30:00.000Z",
                "lastUpdated": "2015-07-24T11:30:00.000Z",
                "parameters": [
                    "pm25",
                    "pm10",
                    "so2",
                    "co",
                    "no2",
                    "o3"
                ],
                "country": "AU",
                "city": "Central Coast",
                "location": "wyong"
            },
            ...
        ]
         N/A N/A N/A self _get locations kwargs N/A N/A pandasize measurements N/A N/A self N/A kwargs N/A N/A Provides metadata about distinct measurement locations

        :param city: Limit results by a certain city. Defaults to ``None``.
        :param country: Limit results by a certain country. Should be a 2-digit
                        ISO country code. Defaults to ``None``.
        :param location: Limit results by a city. Defaults to ``None``.
        :param parameter: Limit results by a specific parameter. Options include [
                            pm25, pm10, so2, co, no2, o3, bc]
        :param has_geo: Filter items that do or do not have geographic information.
        :param value_from: Show results above a value threshold.
        :param value_to: Show results below a value threshold.
        :param date_from: Show results after a certain date. Format should be ``Y-M-D``
        :param date_to: Show results before a certain date. Format should be ``Y-M-D``
        :param sort: The sort order (``asc`` or ``desc``).
        :param order_by: Field to sort by. Must be used with **sort**.
        :param include_fields: Include additional fields in the output.
        :param limit: Change the number of results returned.
        :param page: Paginate through the results
        :param skip: Number of records to skip.
        :param df: return the results as a pandas DataFrame
        :param index: if returning as a DataFrame, set index to ('utc', 'local'). The default is local

        :type city: string
        :type country: string
        :type location: string
        :type parameter: string
        :type has_geo: boolean
        :type value_from: number
        :type value_to: number
        :type date_from: date
        :type date_to: date
        :type sort: string
        :type order_by: string
        :type include_fields: array
        :type limit: number
        :type page: number
        :type skip: number
        :type df: boolean
        :type index: string

        :return: a dictionary containing the *date*, *parameter*, *value*, *unit*,
            *location*, *country*, *city*, and *coordinates*.

        :Example:

        >>> import openaq
        >>> api = openaq.OpenAQ()
        >>> status, resp = api.measurements(city = 'Delhi')
        >>> resp
        {
            "parameter": "Ammonia",
            "date": {
                "utc": "2015-07-16T20:30:00.000Z",
                'local': "2015-07-16T18:30:00.000-02:00"
            },
            "value": "72.9",
            "unit": "ug/m3",
            "location": "Anand Vihar",
            "country": "IN",
            "city": "Delhi",
            "coordinates": {
                "latitude": 43.34,
                "longitude": 23.04
            },
            ...
        }
         N/A N/A N/A self _get measurements kwargs N/A N/A pandasize fetches N/A N/A self N/A kwargs N/A N/A Provides data about individual fetch operations that are used to populate
        data in the platform.

        :return: dictionary containing the *timeStarted*, *timeEnded*, *count*, and *results*

        :Example:

        >>> import openaq
        >>> api = openaq.OpenAQ()
        >>> status, resp = api.fetches()
        >>> resp
        {
            "meta": {
                "name": "openaq-api",
                "license":
                "website":
                "page": 1,
                "limit": 100,
                "found": 3
            },
            "results": [
                {
                    "count": 0,
                    "results": [
                        {
                            "message": "New measurements inserted for Mandir Marg: 1",
                            "failures": {},
                            "count": 0,
                            "duration": 0.153,
                            "sourceName": "Mandir Marg"
                        },
                        {
                            "message": "New measurements inserted for Sao Paulo: 1898",
                            "failures": {},
                            "count": 1898,
                            "duration": 16.918,
                            "sourceName": "Sao Paulo"
                        },
                        ...
                    ],
                    "timeStarted": "2016-02-07T15:25:04.603Z",
                    "timeEnded": "2016-02-07T15:25:04.793Z",
                }
            ]
        }
         N/A N/A N/A self _get fetches kwargs N/A __repr__ N/A N/A self N/A N/A N/A OpenAQ API N/A N/A