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