py-trello: 403 Error
Hello, I’m getting a 403 error but the site seems to be up and all services are functional on Trello. Not sure if this is a Cloudflare server-side issue with Trello or an API issue.
Recreate the issue with this:
from trello import TrelloClient TrelloClient(TRELLO_API_KEY).list_boards()
Error:
trello.exceptions.ResourceUnavailable: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<HTML><HEAD><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<TITLE>ERROR: The request could not be satisfied</TITLE>
</HEAD><BODY>
<H1>403 ERROR</H1>
<H2>The request could not be satisfied.</H2>
<HR noshade size="1px">
Bad request.
We can't connect to the server for this app or website at this time. There might be too much traffic or a configuration error. Try again later, or contact the app or website owner.
<BR clear="all">
If you provide content to customers through CloudFront, you can find steps to troubleshoot and help prevent this error by reviewing the CloudFront documentation.
<BR clear="all">
<HR noshade size="1px">
<PRE>
Generated by cloudfront (CloudFront)
Request ID: qCRWUowLKZ3ESPwzuDguR8rVTFatc3uu6U1O8jvYVwnZhRVJr-Elpg==
</PRE>
<ADDRESS>
</ADDRESS>
</BODY></HTML> at https://api.trello.com/1/members/me/boards/?filter=all (HTTP status: 403)
About this issue
- Original URL
- State: open
- Created 3 years ago
- Reactions: 14
- Comments: 15 (1 by maintainers)
Commits related to this issue
- monkey-patch https://github.com/sarumont/py-trello/issues/373 — committed to Shigerman/trello_move by grigoryvp 3 years ago
- fix trello's problem: https://github.com/sarumont/py-trello/issues/373 — committed to zironycho/account-book by zironycho 3 years ago
Problem is located here. https://github.com/sarumont/py-trello/blob/a628d545e936ccdab299cb139f56b8f98836618e/trello/trelloclient.py#L221
When files are not specified in the case for GET calls, it will attempt to convert an empty dictionary to JSON string. This will be sent as “{}” in the body of our GET request.
Currently, I am monkey patching with the following to get by.
Tested and the code worked. This is a quick fix for those who cannot wait for package update.
For personal needs, I have forked this repository and merged two pending PRs into the new repository. https://github.com/Konano/py-trello-api
As a temporary solution, I have also uploaded the new package to Pypi. You can download the fixed py-trello with this command:
pip install py-trello-api==0.20.0I hope this helps someone in need.
Response from Trello support:
https://github.com/sarumont/py-trello/pull/374
This looks to be a permanent change to the API as per: https://developer.atlassian.com/changelog/#CHANGE-1459
Thanks to @jitvimol for the monkey patch – that did the trick for me!