py-openaq icon indicating copy to clipboard operation
py-openaq copied to clipboard

Pagination doesn't seem to work

Open zseta opened this issue 2 years ago • 1 comments

I've been trying to figure out how to paginate through results, as it's mentioned in the API docs, and also in your wrapper it's implemented. But when I try to use it it doesn't return any results.

Eg.:

This code:

api = openaq.OpenAQ()
data = api.measurements(city='Delhi', parameter='pm25', limit=200, page=2)[1]

Returns this:

{
    "meta": {
        "name": "openaq-api",
        "license": "CC BY 4.0d",
        "website": "https://u50g7n0cbj.execute-api.us-east-1.amazonaws.com/",
        "page": 2,
        "limit": 200,
        "found": 4042410,
        "pages": 20213
    },
    "results": []
}

This is not correct because there should be things on page two, I imagine. It's probably not the wrapper's fault, the API just doesn't seem to work properly if page parameter is defined, just wanted to bring this to attention.

zseta avatar Jan 12 '22 09:01 zseta

Hi @zseta I just tried to replicate using curl and find the same result. It seems to be a fundamental limitation with the API - it may be worth raising an issue on their GitHub repo and mentioning this issue.

dhhagan avatar Jan 12 '22 13:01 dhhagan