-
Notifications
You must be signed in to change notification settings - Fork 48
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
Conversation
There was a problem hiding this 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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
@@ -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) |
There was a problem hiding this comment.
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.
Work in progress. Still need to change a number of tests, especially on uploads.