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

Replaced default python-requests user-agent with a custom ones #54

Merged
merged 4 commits into from
Feb 28, 2023

Conversation

keul
Copy link
Contributor

@keul keul commented Mar 26, 2022

Default user-agent sent by cdsapi is inherited from it's dependency python-requests, which is python-requests/x.y.z

So it's not easy to know if the request came from official cdsapi or another Python code script that use python-requests under the hood.

Changing this can improve log analysis and QoS a bit (at least for 99% of users).

HTTP access log will now contains a user-agent field like the following:

… "cdsapi/0.5.1"

This can improve analytics and QOS a bit
@FussyDuck
Copy link

FussyDuck commented Mar 26, 2022

CLA assistant check
All committers have signed the CLA.

@EddyCMWF
Copy link
Collaborator

Hi @keul ,
Is this PR still relevant and useful? If so can you resolve the conflict and I will then review it and merge
Thanks,
Eddy

@keul
Copy link
Contributor Author

keul commented Feb 27, 2023

@EddyCMWF I think it can still be relevant. At the time I was trying to intercept users using the cdsapi, while right now there's not way to differentiate them from other people using "vanilla" Python requests.

If you think it can be useful I can fix conflicts

@gbiavati
Copy link
Collaborator

This should be merged asap

Copy link
Collaborator

@gbiavati gbiavati left a comment

Choose a reason for hiding this comment

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

This feature should be implemented in all api

@keul
Copy link
Contributor Author

keul commented Feb 28, 2023

@gbiavati @EddyCMWF conflicts are fixed

@keul keul requested a review from gbiavati February 28, 2023 15:00
@EddyCMWF EddyCMWF merged commit c41b0db into ecmwf:master Feb 28, 2023
@keul keul deleted the custom-ua branch February 28, 2023 15:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants