Skip to content

[SYNPY-1570, SYNPY-1555] Support passing user_agent to the Synapse class constructor, and HTTPX Library usage #1170

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

Merged
merged 3 commits into from
Mar 4, 2025

Conversation

BryanFauble
Copy link
Member

Problem:

  1. When making HTTP requests with the HTTPX library, we were incorrectly including the User-Agent header from the Python 'requests' package instead of using HTTPX's own User-Agent.
  2. It was cumbersome for users to specify their own additional User-Agent fields to add to the HTTP requests.

Solution:

  1. Replacing the requests package User-Agent header for requests that are using the HTTPX library.
  2. Provide a class argument for the Synapse class that allows users to specify their own User-Agent headers to add.

Testing:

  1. Unit testing the logic for both creating valid/invalid headers, along with verifying that the headers are correct getting added on the outbound requests for the requests and httpx library.

@BryanFauble BryanFauble requested a review from a team as a code owner February 27, 2025 18:45
@BryanFauble BryanFauble merged commit 167d610 into develop Mar 4, 2025
28 checks passed
@BryanFauble BryanFauble deleted the synpy-1570-user-agent-header branch March 4, 2025 17:34
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