Custom User-Agent header, Migrated all bare requests.post() to self.session.post(), Version bump to 2.3.0#68
Merged
Merged
Conversation
hmcguire443
approved these changes
Jul 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a custom
User-Agentheader to all HTTP requests made by the SDK client, enabling server-side tracking of customer usage. Also consolidates all HTTP calls through a singlerequests.Sessionfor consistent retry behavior, connection pooling, and header propagation.Changes
Custom User-Agent Header
SDK_VERSIONclass constant (2.3.0) toJupiterOneClientuser_agentparameter to__init__for caller-provided identifiersjupiterone-client-python/2.3.0(default) orjupiterone-client-python/2.3.0 <custom-suffix>self.headersandself.session.headersto cover all request pathsUsage:
Session Migration
Migrated 8 bare
requests.post()calls toself.session.post()across 4 methods:list_alert_rulesget_alert_rule_detailslist_questionslist_account_parametersThese methods were previously bypassing the session's retry logic (
Retrywith backoff on 429/502/503/504), connection pooling, and now the User-Agent header. All calls now includetimeout=60for consistency.Version Bump
setup.py:2.2.0→2.3.0JupiterOneClient.SDK_VERSION:2.3.0Test Updates
Updated mock targets in 3 test files from
@patch('jupiterone.client.requests.post')to@patch('requests.Session.post')to match the migrated code:tests/test_alert_rule_methods.py(3 tests)tests/test_list_questions.py(15 tests)tests/test_misc_methods.py(2 tests)Test Plan
requests.post/getcalls remain in client.pyself.headersandself.session.headers