r-spacex / SpaceX-API

:rocket: Open Source REST API for SpaceX launch, rocket, core, capsule, starlink, launchpad, and landing pad data.
Apache License 2.0
10.45k stars 926 forks source link

Pagination options in launches/query don't work. No matter what page number you post, query would always return the first page. #1360

Open pavlokurochka opened 1 month ago

pavlokurochka commented 1 month ago

Pagination options in spacexdata don't work. No matter what page number you post, query would always return the first page.

import requests
rc = requests.delete(f"https://api.spacexdata.com/admin/cache")
rc.raise_for_status()
print(rc) 
response = requests.post(
        "https://api.spacexdata.com/v4/launches/query",
        json={
            "query": {
                "date_utc": {
                    "$gt": "2017-01-24T00:00:00.000Z",
                  },
            "options": {
                    "page": 5,
                     "limit": 10
                }
            }
        }
    )
response_json = response.json()
for k in response_json.keys():
  print(f'{k}:{response_json[k]}')

totalDocs:170 offset:0 limit:10 totalPages:17 page:1 pagingCounter:1 hasPrevPage:False hasNextPage:True prevPage:None nextPage:2