tghw / trello-py Goto Github PK
View Code? Open in Web Editor NEWA Python wrapper for the Trello API
License: BSD 3-Clause "New" or "Revised" License
A Python wrapper for the Trello API
License: BSD 3-Clause "New" or "Revised" License
Hi,
Looks like it has fixed a few issues including Python 3 support which would be super handy. Any chance we could get this version uploaded to PyPi?
Thanks!
I'm trying to update a card, setting closed to True to hide it from the list:
trello.cards.update(card["id"], closed=True)
And this is the error I get:
Traceback (most recent call last):
File "/home/rcdeoliveira/.local/bin/./update-trello.py", line 39, in <module>
trello.cards.update(card["id"], closed=True)
File "/home/rcdeoliveira/.local/lib/python3.10/site-packages/trello/cards.py", line 81, in update
return self.raise_or_json(resp)
File "/home/rcdeoliveira/.local/lib/python3.10/site-packages/trello/base.py", line 3, in raise_or_json
resp.raise_for_status()
File "/usr/lib/python3/dist-packages/requests/models.py", line 960, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: https://trello.com/1/cards/{cardId}?key={key}&token={token}
Am I doing something wrong?
From Python 3.4 quote_plus is moved to urlib.parse, for that version you have to change the import in trello.init.py:
from urllib.parse import quote_plus
Trello’s API will no longer permit supplying a body with a GET request. Previous behavior in our API ignored the payloads provided with GET requests but these requests will now be blocked with a 403 response from our content delivery network.
To resolve issues resulting from this change ensure all GET requests to Trello’s API are sent without a payload.
https://developer.atlassian.com/changelog/#CHANGE-1459
Setting data to none on GET seems to fix it
# inside trelloclient.py
def fetch_json(
...
...
# set content type and accept headers to handle JSON
if http_method in ("POST", "PUT", "DELETE") and not files:
headers['Content-Type'] = 'application/json; charset=utf-8'
headers['Accept'] = 'application/json'
# ADD THIS PART HERE
if http_method in ("GET"):
data = None
Hope this helps someone
I've installed 0.9.3 but it isn't pulling down Requests
package automatically when I install it. It looks like it is just missing from the setup.py (see attached) even though you have it listed in the master version which is labelled 0.9.2
Is there any documentation, specifically on how to add items to the board?
See this and this. There are two .update()
methods in the Webhooks
class that take different parameters. Looks like a Java-style pattern. However, in Python, it doesn't work like in Java - the second method definition simply overrides the previous one. The result is confusing: by looking at code, you may think that there's a method for updating a webhook by its ID, but in practice, there isn't because it was overridden by the second definition below.
I am confused because it seems that this code has been invalid since commit 3666d8a in 2012, when it was regenerated. Yet people have submitted minor patches since then, none of which fix the glaring syntax problem.
Am I missing something? I tried with Python 3.4.3 and hit the obivous (unless slashes in variable names are a Python 3 feature that I have not read about and the error is elsewhere) syntax error:
$ python -m trello
Traceback (most recent call last):
File "/Users/wcooley/anaconda/envs/python-3.4/lib/python3.4/runpy.py", line 151, in _run_module_as_main
mod_name, mod_spec, code = _get_module_details(mod_name)
File "/Users/wcooley/anaconda/envs/python-3.4/lib/python3.4/runpy.py", line 118, in _get_module_details
return _get_module_details(pkg_main_name)
File "/Users/wcooley/anaconda/envs/python-3.4/lib/python3.4/runpy.py", line 104, in _get_module_details
spec = importlib.util.find_spec(mod_name)
File "/Users/wcooley/anaconda/envs/python-3.4/lib/python3.4/importlib/util.py", line 86, in find_spec
parent = __import__(parent_name, fromlist=['__path__'])
File "/Users/wcooley/src/trello-py/trello/__init__.py", line 3, in <module>
from .boards import Boards
File "/Users/wcooley/src/trello-py/trello/boards.py", line 96
def update(self, board_id, name=None, desc=None, closed=None, subscribed=None, idOrganization=None, prefs/permissionLevel=None, prefs/selfJoin=None, prefs/cardCovers=None, prefs/invitations=None, prefs/voting=None, prefs/comments=None):
^
SyntaxError: invalid syntax
I think the fix should be easy enough -- substitute invalid characters in variable names, but I am unclear if this is code anyone is actually using or I should look for something elsewhere more actively maintained?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.