Skip to content

feat: implement retry logic for HTTP requests on token expiry#61

Merged
TordAreStromsnes merged 2 commits intomainfrom
feat/retry-logic-on-client-expiry
Feb 4, 2026
Merged

feat: implement retry logic for HTTP requests on token expiry#61
TordAreStromsnes merged 2 commits intomainfrom
feat/retry-logic-on-client-expiry

Conversation

@TordAreStromsnes
Copy link
Contributor

APIM has only an hour lifespan for the dsis token. Some runs takes longer than that and some of the data fetching breaks because of it. This should help mitigate this.

Key improvements:

Automatic Token Refresh and Retry Logic

  • Added a private method _make_request_with_retry to HTTPTransportMixin that handles GET requests, automatically refreshing tokens and retrying once on 401 or 500 status codes.

Consistent Use of Retry Logic in Requests

  • Updated the _request, _request_binary, and _request_binary_stream methods to use _make_request_with_retry, ensuring all GET requests benefit from the new retry mechanism.

Type Annotation Updates

  • Updated the return type of _request_binary_stream to Generator[bytes, None, None] for better type safety and clarity.

leefw
leefw previously approved these changes Feb 3, 2026
@TordAreStromsnes TordAreStromsnes merged commit 1c4ff14 into main Feb 4, 2026
6 checks passed
@TordAreStromsnes TordAreStromsnes deleted the feat/retry-logic-on-client-expiry branch February 4, 2026 08:54
TordAreStromsnes pushed a commit that referenced this pull request Feb 4, 2026
🤖 I have created a release *beep* *boop*
---


##
[1.2.0](v1.1.0...v1.2.0)
(2026-02-04)


### Features

* implement retry logic for HTTP requests on token expiry
([#61](#61))
([1c4ff14](1c4ff14))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
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