googleapis / python-storage

Apache License 2.0
439 stars 151 forks source link

Make it possible to update / add to the user-agent for an existing client object #1327

Open MattIrv opened 2 months ago

MattIrv commented 2 months ago

Is your feature request related to a problem? Please describe.

My team is using the Python storage client. When we initialize a new client, we set the user-agent as part of the client_info passed here. However, we'd like users to be able to pass in their own storage clients in order to do things like custom authentication or manage other options. Unfortunately the user-agent does not get set in this case, and there doesn't seem to be any way to edit or append to it for an existing client object.

Describe the solution you'd like

Provide a method or field on the Client object that we can use to edit or append to the user-agent for an existing Client object.

Describe alternatives you've considered

It may be possible for us to somehow duplicate the credentials / options / transport from an existing Client and create a new one and set the user-agent, but that seems error-prone.

Additional context

See our existing code on GitHub for an example of how we set the user-agent for a new client today.