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

Add a user_agent Session parameter to be able to override the default one. #174

Open
Natim opened this issue Apr 4, 2018 · 7 comments
Open

Comments

@Natim
Copy link
Member

Natim commented Apr 4, 2018

I tried Client constructor, update_record method or even Session but with no luck.

I was trying to override the User-Agent

                    headers={'User-Agent': 'backoffice {}'.format(version)}
@glasserc
Copy link
Contributor

glasserc commented Apr 4, 2018

We never added a generic headers parameter to everything because of our experience with kinto-http.js, where it serves multiple purposes that are difficult to untangle. See the discussion on #125. My stance on the topic is still that I'd much rather see specific options for specific use cases. For instance, maybe we should put a user_agent option on Client, the same way there's an auth option.

@Natim Natim changed the title Where am I supposed to put custom headers? Add a user_agent Session parameter to be able to override the default one. Oct 15, 2018
@p-murli
Copy link

p-murli commented Nov 6, 2018

Hey, I'm a newbie and I'd like to work on this. Can I take this up and could you give me a few pointers and help on how to get started

@Natim
Copy link
Member Author

Natim commented Nov 6, 2018

Yes please do 👍

@leplatrem
Copy link
Contributor

could you give me a few pointers and help on how to get started

@Natim ?

@Natim
Copy link
Member Author

Natim commented Nov 6, 2018

Sorry I missed that part @leplatrem 😕

I second what @glasserc said on the subject.
So I would start by adding a user_agent parameter to the client.__init__ function that would go all the way to overriding the user_agent header in the request.

Maybe we can also check if the parameter is a callable in case we want to build the user_agent for each request.

In terms of development flow:

  • Start by forking and creating a branch to your fork with a commit that adds a first test about passing the parameter and overriding the default and current behaviour
  • Then add commits to that branch until you are happy with it.

Along the way I can comment your code so that we can iterate until we get a version that represent what we expect as a feature set for this issue.

Hope this helps.

@bengwie
Copy link

bengwie commented Mar 11, 2021

This issue seems to be open for few years. I am new and would like to give it a try.

@bengwie
Copy link

bengwie commented Mar 11, 2021

I think I have completed the fix. I need to test it locally and have some questions in how to do that. Do we have slack channel or somewhere that I can get live help? Thanks in advance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants