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 HTTP User-Agent to fetchJSON #375

Merged

Conversation

sadlassian
Copy link
Contributor

This adds an HTTP User-Agent to all of the requests made by the client.

Recently, there was an issue where Trello put api.trello.com behind CloudFront, which caused GET requests with an empty body to return a 403 status code (see: #373).

A fix for fixing GET requests with a body is already pending (see: #374).

For future possible issues, adding a User-Agent to this library will help Trello SREs identify where affected traffic is coming from, which means a better experience for users!

@veracus
Copy link

veracus commented Feb 28, 2024

When can we expect this to be merged? Are you looking for more maintainers? cc: @sarumont

@kdinn
Copy link

kdinn commented Mar 13, 2024

Thanks for working out a fix to this issue folks. My site is not talking to Trello any more because of it.

I second the question above: when can we expect this to be merged?

@@ -215,6 +216,9 @@ def fetch_json(
if post_args is None:
post_args = {}

# add user agent header to fetch_json requests
headers['User-Agent'] = generate_user_agent()

# if files specified, we don't want any data
data = None
if files is None:

Choose a reason for hiding this comment

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

I tested your code and it is still not work? Is it possible to add a condition to the post_args parameter, the relevant statement is as follows:

        if files is None and post_args and post_args != {}:
            data = json.dumps(post_args)

@Kab00mKap0w
Copy link

See discussion re: repo's future

@sarumont sarumont merged commit 89115fd into sarumont:master May 31, 2024
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.

6 participants