kinto-http.py icon indicating copy to clipboard operation
kinto-http.py copied to clipboard

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

Open Natim opened this issue 6 years ago • 7 comments

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)}

Natim avatar Apr 04 '18 14:04 Natim

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 https://github.com/Kinto/kinto-http.py/issues/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.

glasserc avatar Apr 04 '18 15:04 glasserc

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

p-murli avatar Nov 06 '18 05:11 p-murli

Yes please do :+1:

Natim avatar Nov 06 '18 09:11 Natim

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

@Natim ?

leplatrem avatar Nov 06 '18 09:11 leplatrem

Sorry I missed that part @leplatrem :confused:

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.

Natim avatar Nov 06 '18 10:11 Natim

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

bengwie avatar Mar 11 '21 00:03 bengwie

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.

bengwie avatar Mar 11 '21 03:03 bengwie