From 649c5297ca96936f1b121b8d3509f1e035a397c6 Mon Sep 17 00:00:00 2001 From: C'tri Date: Thu, 17 Mar 2022 00:31:44 +0000 Subject: [PATCH] Update trello.py Update trello.py --- trello.py | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/trello.py b/trello.py index 8792edf..11cfbc2 100644 --- a/trello.py +++ b/trello.py @@ -153,16 +153,8 @@ def add_item_to_checklist(self, checklistID, text): return return - def fetch_checklist_content(self, checklist_id): - url = "https://api.trello.com/1/checklists/%s" % (checklist_id) - params = self._get_trello_params() - r = requests.get(url=url,params=params) - if r.status_code != 200: - lo.error("Couldn't fetch checklist content %s" % (r.status_code, r.content)) - - def delete_checklist_item(self,checklist_id, checklist_item_id): - url = "https://api.trello.com/1/checklists/%s/checkItems/%s" % (checklist_id,checklist_id,checklist_item_id) + url = "https://api.trello.com/1/checklists/%s/checkItems/%s" % (checklist_id,checklist_item_id) params = self._get_trello_params() r = requests.delete(url,params=params) if r.status_code != 200: @@ -230,3 +222,15 @@ def deleteTrelloCard(self,trelloCardID): print(r.reason) + + def fetch_checklist_content(self, checklist_id) ->list: + url = "https://api.trello.com/1/checklists/%s" % (checklist_id) + params = self._get_trello_params() + r = requests.get(url=url,params=params) + if r.status_code != 200: + lo.error("Couldn't fetch checklist content %s" % (r.status_code, r.content)) + try: + content = json.loads(r.content)["checkItems"] + except Exception as e: + lo.error(f"Couldn't parse the json from the fetch_checklist_content method for {checklist_id}") + return content \ No newline at end of file