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 for external requests #1096

Merged
merged 9 commits into from
Sep 18, 2024
Merged

add a user agent for external requests #1096

merged 9 commits into from
Sep 18, 2024

Conversation

shapiromatron
Copy link
Owner

@shapiromatron shapiromatron commented Sep 5, 2024

Add a User-Agent for all external http requests. This makes it easier for 3rd party tools to identify our software; the user agent can be configured by changing the HAWC_USER_AGENT environment variable.

In addition, standardize how we make external requests using a custom request session.

Finally, refactor the ancient pubmed.py file slightly to make the logic a little bit easier to follow. It's still messy, but we get the pubmed API key directly from the django config settings instead of an old singleton pattern (I think I just learned about that design pattern in school when I wrote this 🤣 ).

I regenerated all the VCR cassettes to confirm that everything did still work as expected.

@shapiromatron shapiromatron marked this pull request as ready for review September 5, 2024 04:13
@shapiromatron shapiromatron marked this pull request as draft September 5, 2024 04:20
@shapiromatron shapiromatron requested review from rabstejnek and removed request for munnsmunns September 6, 2024 18:32
@shapiromatron shapiromatron marked this pull request as ready for review September 6, 2024 18:34
@shapiromatron shapiromatron requested review from munnsmunns and removed request for rabstejnek September 9, 2024 13:37
Copy link
Collaborator

@munnsmunns munnsmunns left a comment

Choose a reason for hiding this comment

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

LGTM! Nice to see the Pubmed bit refactored as well.

@shapiromatron shapiromatron merged commit 1e1e763 into main Sep 18, 2024
6 checks passed
@shapiromatron shapiromatron deleted the user-agent branch September 18, 2024 20:29
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.

3 participants