A => trello/__init__.py +42 -0
@@ 0,0 1,42 @@
+from urllib import quote_plus
+from .actions import Actions
+from .boards import Boards
+from .cards import Cards
+from .checklists import Checklists
+from .lists import Lists
+from .members import Members
+from .notifications import Notifications
+from .organizations import Organizations
+from .tokens import Tokens
+
+
+class TrelloApi(object):
+ def __init__(self, apikey, token=None):
+ self._apikey = apikey
+ self._token = token
+ self.actions = Actions(apikey, token)
+ self.boards = Boards(apikey, token)
+ self.cards = Cards(apikey, token)
+ self.checklists = Checklists(apikey, token)
+ self.lists = Lists(apikey, token)
+ self.members = Members(apikey, token)
+ self.notifications = Notifications(apikey, token)
+ self.organizations = Organizations(apikey, token)
+ self.tokens = Tokens(apikey, token)
+
+
+ def set_token(self, token):
+ self._token = token
+ self.actions._token = token
+ self.boards._token = token
+ self.cards._token = token
+ self.checklists._token = token
+ self.lists._token = token
+ self.members._token = token
+ self.notifications._token = token
+ self.organizations._token = token
+ self.tokens._token = token
+
+
+ def get_token_url(self, app_name, expires='30days', write_access=True):
+ return 'https://trello.com/1/authorize?key=%s&name=%s&expiration=%s&response_type=token&scope=%s' % (self._apikey, quote_plus(app_name), expires, 'read,write' if write_access else 'read')
A => trello/actions.py +79 -0
@@ 0,0 1,79 @@
+import json
+import requests
+
+class Actions(object):
+ def __init__(self, apikey, token=None):
+ self._apikey = apikey
+ self._token = token
+
+ def get(self, action_id, fields=None):
+ resp = requests.get("https://trello.com/1/actions/%s" % (action_id), params=dict(key=self._apikey, token=self._token, fields=fields), data=None)
+ resp.raise_for_status()
+ return json.loads(resp.content)
+
+ def get_field(self, field, action_id):
+ resp = requests.get("https://trello.com/1/actions/%s/%s" % (action_id, field), params=dict(key=self._apikey, token=self._token), data=None)
+ resp.raise_for_status()
+ return json.loads(resp.content)
+
+ def get_board(self, action_id, fields=None):
+ resp = requests.get("https://trello.com/1/actions/%s/board" % (action_id), params=dict(key=self._apikey, token=self._token, fields=fields), data=None)
+ resp.raise_for_status()
+ return json.loads(resp.content)
+
+ def get_board_field(self, field, action_id):
+ resp = requests.get("https://trello.com/1/actions/%s/board/%s" % (action_id, field), params=dict(key=self._apikey, token=self._token), data=None)
+ resp.raise_for_status()
+ return json.loads(resp.content)
+
+ def get_card(self, action_id, fields=None):
+ resp = requests.get("https://trello.com/1/actions/%s/card" % (action_id), params=dict(key=self._apikey, token=self._token, fields=fields), data=None)
+ resp.raise_for_status()
+ return json.loads(resp.content)
+
+ def get_card_field(self, field, action_id):
+ resp = requests.get("https://trello.com/1/actions/%s/card/%s" % (action_id, field), params=dict(key=self._apikey, token=self._token), data=None)
+ resp.raise_for_status()
+ return json.loads(resp.content)
+
+ def get_list(self, action_id, fields=None):
+ resp = requests.get("https://trello.com/1/actions/%s/list" % (action_id), params=dict(key=self._apikey, token=self._token, fields=fields), data=None)
+ resp.raise_for_status()
+ return json.loads(resp.content)
+
+ def get_list_field(self, field, action_id):
+ resp = requests.get("https://trello.com/1/actions/%s/list/%s" % (action_id, field), params=dict(key=self._apikey, token=self._token), data=None)
+ resp.raise_for_status()
+ return json.loads(resp.content)
+
+ def get_member(self, action_id, fields=None):
+ resp = requests.get("https://trello.com/1/actions/%s/member" % (action_id), params=dict(key=self._apikey, token=self._token, fields=fields), data=None)
+ resp.raise_for_status()
+ return json.loads(resp.content)
+
+ def get_member_field(self, field, action_id):
+ resp = requests.get("https://trello.com/1/actions/%s/member/%s" % (action_id, field), params=dict(key=self._apikey, token=self._token), data=None)
+ resp.raise_for_status()
+ return json.loads(resp.content)
+
+ def get_memberCreator(self, action_id, fields=None):
+ resp = requests.get("https://trello.com/1/actions/%s/memberCreator" % (action_id), params=dict(key=self._apikey, token=self._token, fields=fields), data=None)
+ resp.raise_for_status()
+ return json.loads(resp.content)
+
+ def get_memberCreator_field(self, field, action_id):
+ resp = requests.get("https://trello.com/1/actions/%s/memberCreator/%s" % (action_id, field), params=dict(key=self._apikey, token=self._token), data=None)
+ resp.raise_for_status()
+ return json.loads(resp.content)
+
+ def get_organization(self, action_id, fields=None):
+ resp = requests.get("https://trello.com/1/actions/%s/organization" % (action_id), params=dict(key=self._apikey, token=self._token, fields=fields), data=None)
+ resp.raise_for_status()
+ return json.loads(resp.content)
+
+ def get_organization_field(self, field, action_id):
+ resp = requests.get("https://trello.com/1/actions/%s/organization/%s" % (action_id, field), params=dict(key=self._apikey, token=self._token), data=None)
+ resp.raise_for_status()
+ return json.loads(resp.content)
+
+
A => trello/boards.py +109 -0
@@ 0,0 1,109 @@
+import json
+import requests
+
+class Boards(object):
+ def __init__(self, apikey, token=None):
+ self._apikey = apikey
+ self._token = token
+
+ def get(self, board_id, actions=None, action_fields=None, action_limit=None, cards=None, card_fields=None, lists=None, list_fields=None, members=None, member_fields=None, checklists=None, checklist_fields=None, organization=None, organization_fields=None, fields=None):
+ resp = requests.get("https://trello.com/1/boards/%s" % (board_id), params=dict(key=self._apikey, token=self._token, actions=actions, action_fields=action_fields, action_limit=action_limit, cards=cards, card_fields=card_fields, lists=lists, list_fields=list_fields, members=members, member_fields=member_fields, checklists=checklists, checklist_fields=checklist_fields, organization=organization, organization_fields=organization_fields, fields=fields), data=None)
+ resp.raise_for_status()
+ return json.loads(resp.content)
+
+ def get_field(self, field, board_id):
+ resp = requests.get("https://trello.com/1/boards/%s/%s" % (board_id, field), params=dict(key=self._apikey, token=self._token), data=None)
+ resp.raise_for_status()
+ return json.loads(resp.content)
+
+ def get_action(self, board_id, filter=None, fields=None, limit=None, page=None):
+ resp = requests.get("https://trello.com/1/boards/%s/actions" % (board_id), params=dict(key=self._apikey, token=self._token, filter=filter, fields=fields, limit=limit, page=page), data=None)
+ resp.raise_for_status()
+ return json.loads(resp.content)
+
+ def get_card(self, board_id, actions=None, attachments=None, members=None, checkItemStates=None, badges=None, labels=None, checklists=None, filter=None, fields=None):
+ resp = requests.get("https://trello.com/1/boards/%s/cards" % (board_id), params=dict(key=self._apikey, token=self._token, actions=actions, attachments=attachments, members=members, checkItemStates=checkItemStates, badges=badges, labels=labels, checklists=checklists, filter=filter, fields=fields), data=None)
+ resp.raise_for_status()
+ return json.loads(resp.content)
+
+ def get_card_filter(self, filter, board_id):
+ resp = requests.get("https://trello.com/1/boards/%s/cards/%s" % (board_id, filter), params=dict(key=self._apikey, token=self._token), data=None)
+ resp.raise_for_status()
+ return json.loads(resp.content)
+
+ def get_card_idCard(self, idCard, board_id, actions=None, action_fields=None, action_limit=None, members=None, member_fields=None, checkItemStates=None, checkItemState_fields=None, badges=None, labels=None, checklists=None, checklist_fields=None, fields=None):
+ resp = requests.get("https://trello.com/1/boards/%s/cards/%s" % (board_id, idCard), params=dict(key=self._apikey, token=self._token, actions=actions, action_fields=action_fields, action_limit=action_limit, members=members, member_fields=member_fields, checkItemStates=checkItemStates, checkItemState_fields=checkItemState_fields, badges=badges, labels=labels, checklists=checklists, checklist_fields=checklist_fields, fields=fields), data=None)
+ resp.raise_for_status()
+ return json.loads(resp.content)
+
+ def get_checklist(self, board_id, cards=None, card_fields=None, checkItems=None, checkItem_fields=None, filter=None, fields=None):
+ resp = requests.get("https://trello.com/1/boards/%s/checklists" % (board_id), params=dict(key=self._apikey, token=self._token, cards=cards, card_fields=card_fields, checkItems=checkItems, checkItem_fields=checkItem_fields, filter=filter, fields=fields), data=None)
+ resp.raise_for_status()
+ return json.loads(resp.content)
+
+ def get_list(self, board_id, cards=None, card_fields=None, filter=None, fields=None):
+ resp = requests.get("https://trello.com/1/boards/%s/lists" % (board_id), params=dict(key=self._apikey, token=self._token, cards=cards, card_fields=card_fields, filter=filter, fields=fields), data=None)
+ resp.raise_for_status()
+ return json.loads(resp.content)
+
+ def get_list_filter(self, filter, board_id):
+ resp = requests.get("https://trello.com/1/boards/%s/lists/%s" % (board_id, filter), params=dict(key=self._apikey, token=self._token), data=None)
+ resp.raise_for_status()
+ return json.loads(resp.content)
+
+ def get_member(self, board_id, filter=None, fields=None):
+ resp = requests.get("https://trello.com/1/boards/%s/members" % (board_id), params=dict(key=self._apikey, token=self._token, filter=filter, fields=fields), data=None)
+ resp.raise_for_status()
+ return json.loads(resp.content)
+
+ def get_member_filter(self, filter, board_id):
+ resp = requests.get("https://trello.com/1/boards/%s/members/%s" % (board_id, filter), params=dict(key=self._apikey, token=self._token), data=None)
+ resp.raise_for_status()
+ return json.loads(resp.content)
+
+ def get_organization(self, board_id, fields=None):
+ resp = requests.get("https://trello.com/1/boards/%s/organization" % (board_id), params=dict(key=self._apikey, token=self._token, fields=fields), data=None)
+ resp.raise_for_status()
+ return json.loads(resp.content)
+
+ def get_organization_field(self, field, board_id):
+ resp = requests.get("https://trello.com/1/boards/%s/organization/%s" % (board_id, field), params=dict(key=self._apikey, token=self._token), data=None)
+ resp.raise_for_status()
+ return json.loads(resp.content)
+
+ def update(self, board_id, name=None, desc=None, closed=None):
+ resp = requests.put("https://trello.com/1/boards/%s" % (board_id), params=dict(key=self._apikey, token=self._token), data=dict(name=name, desc=desc, closed=closed))
+ resp.raise_for_status()
+ return json.loads(resp.content)
+
+ def update_closed(self, board_id, value):
+ resp = requests.put("https://trello.com/1/boards/%s/closed" % (board_id), params=dict(key=self._apikey, token=self._token), data=dict(value=value))
+ resp.raise_for_status()
+ return json.loads(resp.content)
+
+ def update_desc(self, board_id, value):
+ resp = requests.put("https://trello.com/1/boards/%s/desc" % (board_id), params=dict(key=self._apikey, token=self._token), data=dict(value=value))
+ resp.raise_for_status()
+ return json.loads(resp.content)
+
+ def update_name(self, board_id, value):
+ resp = requests.put("https://trello.com/1/boards/%s/name" % (board_id), params=dict(key=self._apikey, token=self._token), data=dict(value=value))
+ resp.raise_for_status()
+ return json.loads(resp.content)
+
+ def new(self, name, desc=None, idOrganization=None):
+ resp = requests.post("https://trello.com/1/boards" % (), params=dict(key=self._apikey, token=self._token), data=dict(name=name, desc=desc, idOrganization=idOrganization))
+ resp.raise_for_status()
+ return json.loads(resp.content)
+
+ def new_checklist(self, board_id, name):
+ resp = requests.post("https://trello.com/1/boards/%s/checklists" % (board_id), params=dict(key=self._apikey, token=self._token), data=dict(name=name))
+ resp.raise_for_status()
+ return json.loads(resp.content)
+
+ def new_list(self, board_id, name):
+ resp = requests.post("https://trello.com/1/boards/%s/lists" % (board_id), params=dict(key=self._apikey, token=self._token), data=dict(name=name))
+ resp.raise_for_status()
+ return json.loads(resp.content)
+
+
A => trello/cards.py +154 -0
@@ 0,0 1,154 @@
+import json
+import requests
+
+class Cards(object):
+ def __init__(self, apikey, token=None):
+ self._apikey = apikey
+ self._token = token
+
+ def get(self, card_id, actions=None, action_fields=None, action_limit=None, attachments=None, attachment_fields=None, members=None, member_fields=None, checkItemStates=None, checkItemState_fields=None, badges=None, labels=None, checklists=None, checklist_fields=None, fields=None):
+ resp = requests.get("https://trello.com/1/cards/%s" % (card_id), params=dict(key=self._apikey, token=self._token, actions=actions, action_fields=action_fields, action_limit=action_limit, attachments=attachments, attachment_fields=attachment_fields, members=members, member_fields=member_fields, checkItemStates=checkItemStates, checkItemState_fields=checkItemState_fields, badges=badges, labels=labels, checklists=checklists, checklist_fields=checklist_fields, fields=fields), data=None)
+ resp.raise_for_status()
+ return json.loads(resp.content)
+
+ def get_field(self, field, card_id):
+ resp = requests.get("https://trello.com/1/cards/%s/%s" % (card_id, field), params=dict(key=self._apikey, token=self._token), data=None)
+ resp.raise_for_status()
+ return json.loads(resp.content)
+
+ def get_action(self, card_id, filter=None, fields=None, limit=None, page=None):
+ resp = requests.get("https://trello.com/1/cards/%s/actions" % (card_id), params=dict(key=self._apikey, token=self._token, filter=filter, fields=fields, limit=limit, page=page), data=None)
+ resp.raise_for_status()
+ return json.loads(resp.content)
+
+ def get_attachment(self, card_id, fields=None):
+ resp = requests.get("https://trello.com/1/cards/%s/attachments" % (card_id), params=dict(key=self._apikey, token=self._token, fields=fields), data=None)
+ resp.raise_for_status()
+ return json.loads(resp.content)
+
+ def get_badge(self, card_id):
+ resp = requests.get("https://trello.com/1/cards/%s/badges" % (card_id), params=dict(key=self._apikey, token=self._token), data=None)
+ resp.raise_for_status()
+ return json.loads(resp.content)
+
+ def get_board(self, card_id, fields=None):
+ resp = requests.get("https://trello.com/1/cards/%s/board" % (card_id), params=dict(key=self._apikey, token=self._token, fields=fields), data=None)
+ resp.raise_for_status()
+ return json.loads(resp.content)
+
+ def get_board_field(self, field, card_id):
+ resp = requests.get("https://trello.com/1/cards/%s/board/%s" % (card_id, field), params=dict(key=self._apikey, token=self._token), data=None)
+ resp.raise_for_status()
+ return json.loads(resp.content)
+
+ def get_checkItemState(self, card_id, fields=None):
+ resp = requests.get("https://trello.com/1/cards/%s/checkItemStates" % (card_id), params=dict(key=self._apikey, token=self._token, fields=fields), data=None)
+ resp.raise_for_status()
+ return json.loads(resp.content)
+
+ def get_checklist(self, card_id, cards=None, card_fields=None, checkItems=None, checkItem_fields=None, filter=None, fields=None):
+ resp = requests.get("https://trello.com/1/cards/%s/checklists" % (card_id), params=dict(key=self._apikey, token=self._token, cards=cards, card_fields=card_fields, checkItems=checkItems, checkItem_fields=checkItem_fields, filter=filter, fields=fields), data=None)
+ resp.raise_for_status()
+ return json.loads(resp.content)
+
+ def get_label(self, card_id):
+ resp = requests.get("https://trello.com/1/cards/%s/labels" % (card_id), params=dict(key=self._apikey, token=self._token), data=None)
+ resp.raise_for_status()
+ return json.loads(resp.content)
+
+ def get_list(self, card_id, fields=None):
+ resp = requests.get("https://trello.com/1/cards/%s/list" % (card_id), params=dict(key=self._apikey, token=self._token, fields=fields), data=None)
+ resp.raise_for_status()
+ return json.loads(resp.content)
+
+ def get_list_field(self, field, card_id):
+ resp = requests.get("https://trello.com/1/cards/%s/list/%s" % (card_id, field), params=dict(key=self._apikey, token=self._token), data=None)
+ resp.raise_for_status()
+ return json.loads(resp.content)
+
+ def get_member(self, card_id, fields=None):
+ resp = requests.get("https://trello.com/1/cards/%s/members" % (card_id), params=dict(key=self._apikey, token=self._token, fields=fields), data=None)
+ resp.raise_for_status()
+ return json.loads(resp.content)
+
+ def update(self, card_id, name=None, desc=None, closed=None, idList=None, due=None):
+ resp = requests.put("https://trello.com/1/cards/%s" % (card_id), params=dict(key=self._apikey, token=self._token), data=dict(name=name, desc=desc, closed=closed, idList=idList, due=due))
+ resp.raise_for_status()
+ return json.loads(resp.content)
+
+ def update_closed(self, card_id, value):
+ resp = requests.put("https://trello.com/1/cards/%s/closed" % (card_id), params=dict(key=self._apikey, token=self._token), data=dict(value=value))
+ resp.raise_for_status()
+ return json.loads(resp.content)
+
+ def update_desc(self, card_id, value):
+ resp = requests.put("https://trello.com/1/cards/%s/desc" % (card_id), params=dict(key=self._apikey, token=self._token), data=dict(value=value))
+ resp.raise_for_status()
+ return json.loads(resp.content)
+
+ def update_due(self, card_id, value):
+ resp = requests.put("https://trello.com/1/cards/%s/due" % (card_id), params=dict(key=self._apikey, token=self._token), data=dict(value=value))
+ resp.raise_for_status()
+ return json.loads(resp.content)
+
+ def update_idList(self, card_id, value):
+ resp = requests.put("https://trello.com/1/cards/%s/idList" % (card_id), params=dict(key=self._apikey, token=self._token), data=dict(value=value))
+ resp.raise_for_status()
+ return json.loads(resp.content)
+
+ def update_name(self, card_id, value):
+ resp = requests.put("https://trello.com/1/cards/%s/name" % (card_id), params=dict(key=self._apikey, token=self._token), data=dict(value=value))
+ resp.raise_for_status()
+ return json.loads(resp.content)
+
+ def new(self, name, idList, desc=None):
+ resp = requests.post("https://trello.com/1/cards" % (), params=dict(key=self._apikey, token=self._token), data=dict(name=name, idList=idList, desc=desc))
+ resp.raise_for_status()
+ return json.loads(resp.content)
+
+ def new_action_comment(self, card_id, text):
+ resp = requests.post("https://trello.com/1/cards/%s/actions/comments" % (card_id), params=dict(key=self._apikey, token=self._token), data=dict(text=text))
+ resp.raise_for_status()
+ return json.loads(resp.content)
+
+ def new_attachment(self, card_id, url, name):
+ resp = requests.post("https://trello.com/1/cards/%s/attachments" % (card_id), params=dict(key=self._apikey, token=self._token), data=dict(url=url, name=name))
+ resp.raise_for_status()
+ return json.loads(resp.content)
+
+ def new_checklist(self, card_id, value):
+ resp = requests.post("https://trello.com/1/cards/%s/checklists" % (card_id), params=dict(key=self._apikey, token=self._token), data=dict(value=value))
+ resp.raise_for_status()
+ return json.loads(resp.content)
+
+ def new_label(self, card_id, value):
+ resp = requests.post("https://trello.com/1/cards/%s/labels" % (card_id), params=dict(key=self._apikey, token=self._token), data=dict(value=value))
+ resp.raise_for_status()
+ return json.loads(resp.content)
+
+ def new_member(self, card_id, value):
+ resp = requests.post("https://trello.com/1/cards/%s/members" % (card_id), params=dict(key=self._apikey, token=self._token), data=dict(value=value))
+ resp.raise_for_status()
+ return json.loads(resp.content)
+
+ def delete(self, card_id):
+ resp = requests.delete("https://trello.com/1/cards/%s" % (card_id), params=dict(key=self._apikey, token=self._token), data=None)
+ resp.raise_for_status()
+ return json.loads(resp.content)
+
+ def delete_checklist_idChecklist(self, idChecklist, card_id):
+ resp = requests.delete("https://trello.com/1/cards/%s/checklists/%s" % (card_id, idChecklist), params=dict(key=self._apikey, token=self._token), data=None)
+ resp.raise_for_status()
+ return json.loads(resp.content)
+
+ def delete_label_color(self, color, card_id):
+ resp = requests.delete("https://trello.com/1/cards/%s/labels/%s" % (card_id, color), params=dict(key=self._apikey, token=self._token), data=None)
+ resp.raise_for_status()
+ return json.loads(resp.content)
+
+ def delete_member_idMember(self, idMember, card_id):
+ resp = requests.delete("https://trello.com/1/cards/%s/members/%s" % (card_id, idMember), params=dict(key=self._apikey, token=self._token), data=None)
+ resp.raise_for_status()
+ return json.loads(resp.content)
+
+
A => trello/checklists.py +69 -0
@@ 0,0 1,69 @@
+import json
+import requests
+
+class Checklists(object):
+ def __init__(self, apikey, token=None):
+ self._apikey = apikey
+ self._token = token
+
+ def get(self, checklist_id, cards=None, card_fields=None, checkitems=None, checkitem_fields=None, fields=None):
+ resp = requests.get("https://trello.com/1/checklists/%s" % (checklist_id), params=dict(key=self._apikey, token=self._token, cards=cards, card_fields=card_fields, checkitems=checkitems, checkitem_fields=checkitem_fields, fields=fields), data=None)
+ resp.raise_for_status()
+ return json.loads(resp.content)
+
+ def get_field(self, field, checklist_id):
+ resp = requests.get("https://trello.com/1/checklists/%s/%s" % (checklist_id, field), params=dict(key=self._apikey, token=self._token), data=None)
+ resp.raise_for_status()
+ return json.loads(resp.content)
+
+ def get_board(self, checklist_id, fields=None):
+ resp = requests.get("https://trello.com/1/checklists/%s/board" % (checklist_id), params=dict(key=self._apikey, token=self._token, fields=fields), data=None)
+ resp.raise_for_status()
+ return json.loads(resp.content)
+
+ def get_board_field(self, field, checklist_id):
+ resp = requests.get("https://trello.com/1/checklists/%s/board/%s" % (checklist_id, field), params=dict(key=self._apikey, token=self._token), data=None)
+ resp.raise_for_status()
+ return json.loads(resp.content)
+
+ def get_card(self, checklist_id, actions=None, attachments=None, members=None, checkItemStates=None, badges=None, labels=None, checklists=None, filter=None, fields=None):
+ resp = requests.get("https://trello.com/1/checklists/%s/cards" % (checklist_id), params=dict(key=self._apikey, token=self._token, actions=actions, attachments=attachments, members=members, checkItemStates=checkItemStates, badges=badges, labels=labels, checklists=checklists, filter=filter, fields=fields), data=None)
+ resp.raise_for_status()
+ return json.loads(resp.content)
+
+ def get_card_filter(self, filter, checklist_id):
+ resp = requests.get("https://trello.com/1/checklists/%s/cards/%s" % (checklist_id, filter), params=dict(key=self._apikey, token=self._token), data=None)
+ resp.raise_for_status()
+ return json.loads(resp.content)
+
+ def get_checkitem(self, checklist_id, filter=None, fields=None):
+ resp = requests.get("https://trello.com/1/checklists/%s/checkitems" % (checklist_id), params=dict(key=self._apikey, token=self._token, filter=filter, fields=fields), data=None)
+ resp.raise_for_status()
+ return json.loads(resp.content)
+
+ def update(self, checklist_id, name=None):
+ resp = requests.put("https://trello.com/1/checklists/%s" % (checklist_id), params=dict(key=self._apikey, token=self._token), data=dict(name=name))
+ resp.raise_for_status()
+ return json.loads(resp.content)
+
+ def update_name(self, checklist_id, value):
+ resp = requests.put("https://trello.com/1/checklists/%s/name" % (checklist_id), params=dict(key=self._apikey, token=self._token), data=dict(value=value))
+ resp.raise_for_status()
+ return json.loads(resp.content)
+
+ def new(self, name, idBoard):
+ resp = requests.post("https://trello.com/1/checklists" % (), params=dict(key=self._apikey, token=self._token), data=dict(name=name, idBoard=idBoard))
+ resp.raise_for_status()
+ return json.loads(resp.content)
+
+ def new_checkitem(self, checklist_id, name):
+ resp = requests.post("https://trello.com/1/checklists/%s/checkitems" % (checklist_id), params=dict(key=self._apikey, token=self._token), data=dict(name=name))
+ resp.raise_for_status()
+ return json.loads(resp.content)
+
+ def delete_checkitem_idCheckItem(self, idCheckItem, checklist_id):
+ resp = requests.delete("https://trello.com/1/checklists/%s/checkitems/%s" % (checklist_id, idCheckItem), params=dict(key=self._apikey, token=self._token), data=None)
+ resp.raise_for_status()
+ return json.loads(resp.content)
+
+
A => trello/lists.py +69 -0
@@ 0,0 1,69 @@
+import json
+import requests
+
+class Lists(object):
+ def __init__(self, apikey, token=None):
+ self._apikey = apikey
+ self._token = token
+
+ def get(self, list_id, cards=None, card_fields=None, fields=None):
+ resp = requests.get("https://trello.com/1/lists/%s" % (list_id), params=dict(key=self._apikey, token=self._token, cards=cards, card_fields=card_fields, fields=fields), data=None)
+ resp.raise_for_status()
+ return json.loads(resp.content)
+
+ def get_field(self, field, list_id):
+ resp = requests.get("https://trello.com/1/lists/%s/%s" % (list_id, field), params=dict(key=self._apikey, token=self._token), data=None)
+ resp.raise_for_status()
+ return json.loads(resp.content)
+
+ def get_action(self, list_id, filter=None, fields=None, limit=None, page=None):
+ resp = requests.get("https://trello.com/1/lists/%s/actions" % (list_id), params=dict(key=self._apikey, token=self._token, filter=filter, fields=fields, limit=limit, page=page), data=None)
+ resp.raise_for_status()
+ return json.loads(resp.content)
+
+ def get_board(self, list_id, fields=None):
+ resp = requests.get("https://trello.com/1/lists/%s/board" % (list_id), params=dict(key=self._apikey, token=self._token, fields=fields), data=None)
+ resp.raise_for_status()
+ return json.loads(resp.content)
+
+ def get_board_field(self, field, list_id):
+ resp = requests.get("https://trello.com/1/lists/%s/board/%s" % (list_id, field), params=dict(key=self._apikey, token=self._token), data=None)
+ resp.raise_for_status()
+ return json.loads(resp.content)
+
+ def get_card(self, list_id, actions=None, attachments=None, members=None, checkItemStates=None, badges=None, labels=None, checklists=None, filter=None, fields=None):
+ resp = requests.get("https://trello.com/1/lists/%s/cards" % (list_id), params=dict(key=self._apikey, token=self._token, actions=actions, attachments=attachments, members=members, checkItemStates=checkItemStates, badges=badges, labels=labels, checklists=checklists, filter=filter, fields=fields), data=None)
+ resp.raise_for_status()
+ return json.loads(resp.content)
+
+ def get_card_filter(self, filter, list_id):
+ resp = requests.get("https://trello.com/1/lists/%s/cards/%s" % (list_id, filter), params=dict(key=self._apikey, token=self._token), data=None)
+ resp.raise_for_status()
+ return json.loads(resp.content)
+
+ def update(self, list_id, name=None, closed=None):
+ resp = requests.put("https://trello.com/1/lists/%s" % (list_id), params=dict(key=self._apikey, token=self._token), data=dict(name=name, closed=closed))
+ resp.raise_for_status()
+ return json.loads(resp.content)
+
+ def update_closed(self, list_id, value):
+ resp = requests.put("https://trello.com/1/lists/%s/closed" % (list_id), params=dict(key=self._apikey, token=self._token), data=dict(value=value))
+ resp.raise_for_status()
+ return json.loads(resp.content)
+
+ def update_name(self, list_id, value):
+ resp = requests.put("https://trello.com/1/lists/%s/name" % (list_id), params=dict(key=self._apikey, token=self._token), data=dict(value=value))
+ resp.raise_for_status()
+ return json.loads(resp.content)
+
+ def new(self, name, idBoard):
+ resp = requests.post("https://trello.com/1/lists" % (), params=dict(key=self._apikey, token=self._token), data=dict(name=name, idBoard=idBoard))
+ resp.raise_for_status()
+ return json.loads(resp.content)
+
+ def new_card(self, list_id, name, desc=None):
+ resp = requests.post("https://trello.com/1/lists/%s/cards" % (list_id), params=dict(key=self._apikey, token=self._token), data=dict(name=name, desc=desc))
+ resp.raise_for_status()
+ return json.loads(resp.content)
+
+
A => trello/members.py +84 -0
@@ 0,0 1,84 @@
+import json
+import requests
+
+class Members(object):
+ def __init__(self, apikey, token=None):
+ self._apikey = apikey
+ self._token = token
+
+ def get(self, member_id_or_username, actions=None, action_fields=None, action_limit=None, cards=None, card_fields=None, boards=None, board_fields=None, organizations=None, organization_fields=None, fields=None):
+ resp = requests.get("https://trello.com/1/members/%s" % (member_id_or_username), params=dict(key=self._apikey, token=self._token, actions=actions, action_fields=action_fields, action_limit=action_limit, cards=cards, card_fields=card_fields, boards=boards, board_fields=board_fields, organizations=organizations, organization_fields=organization_fields, fields=fields), data=None)
+ resp.raise_for_status()
+ return json.loads(resp.content)
+
+ def get_field(self, field, member_id_or_username):
+ resp = requests.get("https://trello.com/1/members/%s/%s" % (member_id_or_username, field), params=dict(key=self._apikey, token=self._token), data=None)
+ resp.raise_for_status()
+ return json.loads(resp.content)
+
+ def get_action(self, member_id_or_username, filter=None, fields=None, limit=None, page=None):
+ resp = requests.get("https://trello.com/1/members/%s/actions" % (member_id_or_username), params=dict(key=self._apikey, token=self._token, filter=filter, fields=fields, limit=limit, page=page), data=None)
+ resp.raise_for_status()
+ return json.loads(resp.content)
+
+ def get_board(self, member_id_or_username, filter=None, fields=None, actions=None, action_fields=None, action_limit=None):
+ resp = requests.get("https://trello.com/1/members/%s/boards" % (member_id_or_username), params=dict(key=self._apikey, token=self._token, filter=filter, fields=fields, actions=actions, action_fields=action_fields, action_limit=action_limit), data=None)
+ resp.raise_for_status()
+ return json.loads(resp.content)
+
+ def get_board_filter(self, filter, member_id_or_username):
+ resp = requests.get("https://trello.com/1/members/%s/boards/%s" % (member_id_or_username, filter), params=dict(key=self._apikey, token=self._token), data=None)
+ resp.raise_for_status()
+ return json.loads(resp.content)
+
+ def get_card(self, member_id_or_username, actions=None, attachments=None, members=None, checkItemStates=None, badges=None, labels=None, checklists=None, filter=None, fields=None):
+ resp = requests.get("https://trello.com/1/members/%s/cards" % (member_id_or_username), params=dict(key=self._apikey, token=self._token, actions=actions, attachments=attachments, members=members, checkItemStates=checkItemStates, badges=badges, labels=labels, checklists=checklists, filter=filter, fields=fields), data=None)
+ resp.raise_for_status()
+ return json.loads(resp.content)
+
+ def get_card_filter(self, filter, member_id_or_username):
+ resp = requests.get("https://trello.com/1/members/%s/cards/%s" % (member_id_or_username, filter), params=dict(key=self._apikey, token=self._token), data=None)
+ resp.raise_for_status()
+ return json.loads(resp.content)
+
+ def get_notification(self, member_id_or_username, filter=None, read_filter=None, fields=None, limit=None, page=None):
+ resp = requests.get("https://trello.com/1/members/%s/notifications" % (member_id_or_username), params=dict(key=self._apikey, token=self._token, filter=filter, read_filter=read_filter, fields=fields, limit=limit, page=page), data=None)
+ resp.raise_for_status()
+ return json.loads(resp.content)
+
+ def get_notification_filter(self, filter, member_id_or_username):
+ resp = requests.get("https://trello.com/1/members/%s/notifications/%s" % (member_id_or_username, filter), params=dict(key=self._apikey, token=self._token), data=None)
+ resp.raise_for_status()
+ return json.loads(resp.content)
+
+ def get_organization(self, member_id_or_username, filter=None, fields=None):
+ resp = requests.get("https://trello.com/1/members/%s/organizations" % (member_id_or_username), params=dict(key=self._apikey, token=self._token, filter=filter, fields=fields), data=None)
+ resp.raise_for_status()
+ return json.loads(resp.content)
+
+ def get_organization_filter(self, filter, member_id_or_username):
+ resp = requests.get("https://trello.com/1/members/%s/organizations/%s" % (member_id_or_username, filter), params=dict(key=self._apikey, token=self._token), data=None)
+ resp.raise_for_status()
+ return json.loads(resp.content)
+
+ def update(self, member_id_or_username, fullName=None, initials=None, bio=None):
+ resp = requests.put("https://trello.com/1/members/%s" % (member_id_or_username), params=dict(key=self._apikey, token=self._token), data=dict(fullName=fullName, initials=initials, bio=bio))
+ resp.raise_for_status()
+ return json.loads(resp.content)
+
+ def update_bio(self, member_id_or_username, value):
+ resp = requests.put("https://trello.com/1/members/%s/bio" % (member_id_or_username), params=dict(key=self._apikey, token=self._token), data=dict(value=value))
+ resp.raise_for_status()
+ return json.loads(resp.content)
+
+ def update_fullName(self, member_id_or_username, value):
+ resp = requests.put("https://trello.com/1/members/%s/fullName" % (member_id_or_username), params=dict(key=self._apikey, token=self._token), data=dict(value=value))
+ resp.raise_for_status()
+ return json.loads(resp.content)
+
+ def update_initial(self, member_id_or_username, value):
+ resp = requests.put("https://trello.com/1/members/%s/initials" % (member_id_or_username), params=dict(key=self._apikey, token=self._token), data=dict(value=value))
+ resp.raise_for_status()
+ return json.loads(resp.content)
+
+
A => trello/notifications.py +79 -0
@@ 0,0 1,79 @@
+import json
+import requests
+
+class Notifications(object):
+ def __init__(self, apikey, token=None):
+ self._apikey = apikey
+ self._token = token
+
+ def get(self, notification_id, fields=None):
+ resp = requests.get("https://trello.com/1/notifications/%s" % (notification_id), params=dict(key=self._apikey, token=self._token, fields=fields), data=None)
+ resp.raise_for_status()
+ return json.loads(resp.content)
+
+ def get_field(self, field, notification_id):
+ resp = requests.get("https://trello.com/1/notifications/%s/%s" % (notification_id, field), params=dict(key=self._apikey, token=self._token), data=None)
+ resp.raise_for_status()
+ return json.loads(resp.content)
+
+ def get_board(self, notification_id, fields=None):
+ resp = requests.get("https://trello.com/1/notifications/%s/board" % (notification_id), params=dict(key=self._apikey, token=self._token, fields=fields), data=None)
+ resp.raise_for_status()
+ return json.loads(resp.content)
+
+ def get_board_field(self, field, notification_id):
+ resp = requests.get("https://trello.com/1/notifications/%s/board/%s" % (notification_id, field), params=dict(key=self._apikey, token=self._token), data=None)
+ resp.raise_for_status()
+ return json.loads(resp.content)
+
+ def get_card(self, notification_id, fields=None):
+ resp = requests.get("https://trello.com/1/notifications/%s/card" % (notification_id), params=dict(key=self._apikey, token=self._token, fields=fields), data=None)
+ resp.raise_for_status()
+ return json.loads(resp.content)
+
+ def get_card_field(self, field, notification_id):
+ resp = requests.get("https://trello.com/1/notifications/%s/card/%s" % (notification_id, field), params=dict(key=self._apikey, token=self._token), data=None)
+ resp.raise_for_status()
+ return json.loads(resp.content)
+
+ def get_list(self, notification_id, fields=None):
+ resp = requests.get("https://trello.com/1/notifications/%s/list" % (notification_id), params=dict(key=self._apikey, token=self._token, fields=fields), data=None)
+ resp.raise_for_status()
+ return json.loads(resp.content)
+
+ def get_list_field(self, field, notification_id):
+ resp = requests.get("https://trello.com/1/notifications/%s/list/%s" % (notification_id, field), params=dict(key=self._apikey, token=self._token), data=None)
+ resp.raise_for_status()
+ return json.loads(resp.content)
+
+ def get_member(self, notification_id, fields=None):
+ resp = requests.get("https://trello.com/1/notifications/%s/member" % (notification_id), params=dict(key=self._apikey, token=self._token, fields=fields), data=None)
+ resp.raise_for_status()
+ return json.loads(resp.content)
+
+ def get_member_field(self, field, notification_id):
+ resp = requests.get("https://trello.com/1/notifications/%s/member/%s" % (notification_id, field), params=dict(key=self._apikey, token=self._token), data=None)
+ resp.raise_for_status()
+ return json.loads(resp.content)
+
+ def get_memberCreator(self, notification_id, fields=None):
+ resp = requests.get("https://trello.com/1/notifications/%s/memberCreator" % (notification_id), params=dict(key=self._apikey, token=self._token, fields=fields), data=None)
+ resp.raise_for_status()
+ return json.loads(resp.content)
+
+ def get_memberCreator_field(self, field, notification_id):
+ resp = requests.get("https://trello.com/1/notifications/%s/memberCreator/%s" % (notification_id, field), params=dict(key=self._apikey, token=self._token), data=None)
+ resp.raise_for_status()
+ return json.loads(resp.content)
+
+ def get_organization(self, notification_id, fields=None):
+ resp = requests.get("https://trello.com/1/notifications/%s/organization" % (notification_id), params=dict(key=self._apikey, token=self._token, fields=fields), data=None)
+ resp.raise_for_status()
+ return json.loads(resp.content)
+
+ def get_organization_field(self, field, notification_id):
+ resp = requests.get("https://trello.com/1/notifications/%s/organization/%s" % (notification_id, field), params=dict(key=self._apikey, token=self._token), data=None)
+ resp.raise_for_status()
+ return json.loads(resp.content)
+
+
A => trello/organizations.py +44 -0
@@ 0,0 1,44 @@
+import json
+import requests
+
+class Organizations(object):
+ def __init__(self, apikey, token=None):
+ self._apikey = apikey
+ self._token = token
+
+ def get(self, org_id_or_name, actions=None, action_fields=None, action_limit=None, members=None, member_fields=None, boards=None, board_fields=None, fields=None):
+ resp = requests.get("https://trello.com/1/organizations/%s" % (org_id_or_name), params=dict(key=self._apikey, token=self._token, actions=actions, action_fields=action_fields, action_limit=action_limit, members=members, member_fields=member_fields, boards=boards, board_fields=board_fields, fields=fields), data=None)
+ resp.raise_for_status()
+ return json.loads(resp.content)
+
+ def get_field(self, field, org_id_or_name):
+ resp = requests.get("https://trello.com/1/organizations/%s/%s" % (org_id_or_name, field), params=dict(key=self._apikey, token=self._token), data=None)
+ resp.raise_for_status()
+ return json.loads(resp.content)
+
+ def get_action(self, org_id_or_name, filter=None, fields=None, limit=None, page=None):
+ resp = requests.get("https://trello.com/1/organizations/%s/actions" % (org_id_or_name), params=dict(key=self._apikey, token=self._token, filter=filter, fields=fields, limit=limit, page=page), data=None)
+ resp.raise_for_status()
+ return json.loads(resp.content)
+
+ def get_board(self, org_id_or_name, filter=None, fields=None, actions=None, action_fields=None, action_limit=None):
+ resp = requests.get("https://trello.com/1/organizations/%s/boards" % (org_id_or_name), params=dict(key=self._apikey, token=self._token, filter=filter, fields=fields, actions=actions, action_fields=action_fields, action_limit=action_limit), data=None)
+ resp.raise_for_status()
+ return json.loads(resp.content)
+
+ def get_board_filter(self, filter, org_id_or_name):
+ resp = requests.get("https://trello.com/1/organizations/%s/boards/%s" % (org_id_or_name, filter), params=dict(key=self._apikey, token=self._token), data=None)
+ resp.raise_for_status()
+ return json.loads(resp.content)
+
+ def get_member(self, org_id_or_name, filter=None, fields=None):
+ resp = requests.get("https://trello.com/1/organizations/%s/members" % (org_id_or_name), params=dict(key=self._apikey, token=self._token, filter=filter, fields=fields), data=None)
+ resp.raise_for_status()
+ return json.loads(resp.content)
+
+ def get_member_filter(self, filter, org_id_or_name):
+ resp = requests.get("https://trello.com/1/organizations/%s/members/%s" % (org_id_or_name, filter), params=dict(key=self._apikey, token=self._token), data=None)
+ resp.raise_for_status()
+ return json.loads(resp.content)
+
+
A => trello/tokens.py +29 -0
@@ 0,0 1,29 @@
+import json
+import requests
+
+class Tokens(object):
+ def __init__(self, apikey, token=None):
+ self._apikey = apikey
+ self._token = token
+
+ def get(self, token, fields=None):
+ resp = requests.get("https://trello.com/1/tokens/%s" % (token), params=dict(key=self._apikey, token=self._token, fields=fields), data=None)
+ resp.raise_for_status()
+ return json.loads(resp.content)
+
+ def get_field(self, field, token):
+ resp = requests.get("https://trello.com/1/tokens/%s/%s" % (token, field), params=dict(key=self._apikey, token=self._token), data=None)
+ resp.raise_for_status()
+ return json.loads(resp.content)
+
+ def get_member(self, token, fields=None):
+ resp = requests.get("https://trello.com/1/tokens/%s/member" % (token), params=dict(key=self._apikey, token=self._token, fields=fields), data=None)
+ resp.raise_for_status()
+ return json.loads(resp.content)
+
+ def get_member_field(self, field, token):
+ resp = requests.get("https://trello.com/1/tokens/%s/member/%s" % (token, field), params=dict(key=self._apikey, token=self._token), data=None)
+ resp.raise_for_status()
+ return json.loads(resp.content)
+
+