Privex / looking-glass

A small network looking glass application in Python
Other
13 stars 5 forks source link

Add pagination support to /api/v1/prefixes #2

Closed Someguy123 closed 4 years ago

Someguy123 commented 4 years ago

Currently the API doesn't support pagination, which can be a problem when viewing ASNs with large amounts of prefixes such as Hurricane Electric (AS6939).

The list_prefixes view ( https://github.com/Privex/looking-glass/blob/master/lg/peerapp/views.py#L117 ) should support the GET parameters limit / skip, and to prevent abuse, limit should have a configurable default and maximum, e.g. DEFAULT_API_LIMIT=1000 MAX_API_LIMIT=10000

Example:

# page 1
GET /api/v1/prefixes?asn=6939&limit=1000

# page 2
GET /api/v1/prefixes?asn=6939&limit=1000&skip=1000
bt-cryptomancer commented 4 years ago

Task complete in linked PR