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

fix: add user-agent on requests #295

Merged
merged 7 commits into from Jan 28, 2022

Conversation

WildSunLove
Copy link
Contributor

Work in progress. Still need to change a number of tests, especially on uploads.

@WildSunLove WildSunLove requested review from a team as code owners January 25, 2022 00:11
@product-auto-label product-auto-label bot added the api: storage Issues related to the googleapis/google-resumable-media-python API. label Jan 25, 2022
google/resumable_media/_download.py Outdated Show resolved Hide resolved
google/resumable_media/_download.py Outdated Show resolved Hide resolved
@WildSunLove WildSunLove changed the title (WIP) fix: add user-agent on requests fix: add user-agent on requests Jan 25, 2022
google/resumable_media/_helpers.py Outdated Show resolved Hide resolved
Copy link
Member

@frankyn frankyn left a comment

Choose a reason for hiding this comment

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

Verified that this is propagating as expected.

Copy link
Contributor

@andrewsg andrewsg left a comment

Choose a reason for hiding this comment

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

Thanks!

@WildSunLove WildSunLove merged commit e107a0c into googleapis:main Jan 28, 2022
@@ -45,6 +46,13 @@ def do_nothing():
"""Simple default callback."""


def _base_headers(headers):
version = pkg_resources.get_distribution("google-resumable-media").version
headers["User-Agent"] = "gcloud-python/{}-resumable-media".format(version)
Copy link
Contributor

Choose a reason for hiding this comment

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

This should not blindly override headers. At most it should append this to the end of an existing header.

I recommend using setdefault() or similar logic next time.

WildSunLove pushed a commit that referenced this pull request Feb 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: storage Issues related to the googleapis/google-resumable-media-python API.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants