Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

check changes in satnogs api pagination #48

Open
wose opened this issue Apr 6, 2024 · 4 comments
Open

check changes in satnogs api pagination #48

wose opened this issue Apr 6, 2024 · 4 comments

Comments

@wose
Copy link
Owner

wose commented Apr 6, 2024

See https://community.libre.space/t/satnogs-monitor-not-running-solved/11590

@wose wose changed the title check changes in satnogs api pagination changes check changes in satnogs api pagination Apr 6, 2024
@michaelachrisco
Copy link

Im getting the same issue as within the form:

image

Even when the ground station has future observations, the tool will not update.

@alitbutt
Copy link

alitbutt commented Aug 11, 2024

As fredy mentioned here : https://community.libre.space/t/satnogs-monitor-not-running-solved/11590
; a recent change in pagination technique to use cursors needs a slight change in /satnogs-network-client/src/client.rs

Specifically line 37 : 53 needs to be replaced with this version:

    let mut pages_remaining = true;
    let mut filter_cursor = "".to_owned();
    while pages_remaining {
        pages_remaining = false;
        let mut filter = filter.clone();
        filter.push(("cursor", &filter_cursor));
        match self.client.get_with((), &filter) {
            Ok(resp) => {
                let resp_data: Response<ObservationList> = resp; 
                let resp_headers = resp_data.headers();
                if resp_headers.contains_key("link") {
                    let link_header = &resp_headers["Link"];
                    let res = parse_link_header::parse(link_header.to_str().unwrap());
                    assert!(res.is_ok());

                    let val = res.unwrap();
                    let next_link = val.get(&Some("next".to_string()));
                    if next_link.is_some() {
                        let next_url = &next_link.unwrap();
                        filter_cursor = next_url.queries["cursor"].to_string();
                        pages_remaining = true;
                    }
                }

                let ObservationList::Array(obs) = resp_data.into_inner();
                observations.extend_from_slice(&obs);
            }
            Err(Error::HttpError(404, _)) => break,
            Err(e) => return Err(e),
        }
    }

This code has an added dependency for parse_link_header in satnogs-network-client

I see API requests at some point getting throttled; might have to handle that case separately.

@kng
Copy link

kng commented Oct 7, 2024

what is the progress on this ? rumors tells me that it is working.

@toine512
Copy link

toine512 commented Oct 7, 2024

A PR exists #50

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants