Skip to content

feat: poll api#230

Merged
rwiker merged 6 commits intomainfrom
feature/poll-api
Feb 18, 2025
Merged

feat: poll api#230
rwiker merged 6 commits intomainfrom
feature/poll-api

Conversation

@rwiker
Copy link
Copy Markdown
Contributor

@rwiker rwiker commented Feb 17, 2025

New methods poll and poll_async. These are meant to be used with long-running requests that run asynchronously; the response from these requests include the headers Location and Retry-After that tell the client where to look for the result of the request, and how long to wait before checking for a result.

Example:

def get_index_orphans(conn: SumoClient):
    res = conn.get("/admin/index/orphans")
    res2  = conn.poll(res)
    assert res2.status_code == 200
    indexorphans = res2.json()
    assert type(indexorphans) == list

@rwiker rwiker requested a review from a team February 17, 2025 14:28
Comment thread src/sumo/wrapper/sumo_client.py Outdated
Copy link
Copy Markdown
Contributor

@equinor-ruaj equinor-ruaj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, but tests seems to disagree

@rwiker rwiker requested a review from equinor-ruaj February 18, 2025 11:25
Copy link
Copy Markdown
Contributor

@equinor-ruaj equinor-ruaj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@rwiker rwiker merged commit b272aa0 into main Feb 18, 2025
@rwiker rwiker deleted the feature/poll-api branch February 18, 2025 12:28
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

Successfully merging this pull request may close these issues.

2 participants