Commit Graph

3 Commits (master)

Author SHA1 Message Date
Sebastian Woetzel f7e11c683a satnogs_client: Use the new scheduling API
[kerel+git@mailbox.org:
- Rebased on master (`schedule_observations` moved from `utils.py`
  to `satnogs_client.py`)
- Moved error logging into the `schedule_observations` function
  (more context available)
- Import python-requests in `satnogs_client` directly instead of
  passing a `requests` object to `schedule_observations`
- Squashed the commits and reworded the commit message
- Changed code formatting]
Signed-off-by: Fabian P. Schmidt <kerel+git@mailbox.org>
2019-11-04 21:04:03 +01:00
Fabian P. Schmidt 0ae102d19b get_scheduled_passes_from_network: Fix next_url logic
The observations endpoint is paginated and ordered by observation
start time, i.e. most recent / future observations come at first.

The `get_scheduled_passes_from_network` method fetches the first page,
parses it, and then fetches new pages as long as the last observation
is still before the user-provided pass scheduling end time.

"Established" stations have plenty of past observations, so this pass
scheduling end time will be reached before the endpoint runs out of
observations (and thus stops to provide a `links['next']['url']` header.

For "young" stations the endpoint will run out of observations though
and the old `get_scheduled_passes_from_network` implementation didn't
detect the missing header and thus failed as described in issue #15.

This commit introduces logic to detect a missing link header.

Fixes issue #15.
2019-11-02 23:44:53 +01:00
Fabian P. Schmidt 3e69cfdcd7 Refactor SatNOGS API calls into an own module
Eventually this module will be replace by the offical SatNOGS API client.
2019-11-02 22:11:17 +01:00