Created
September 21, 2018 07:26
-
-
Save p53ud0k0d3/df9c1bd7b01c3abe211904ef03a13105 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from trello import TrelloClient | |
import requests | |
API_KEY = "" | |
API_SECRET = "" | |
TOKEN = "" | |
BOARD_NO = 0 | |
LIST_NO = 10 | |
client = TrelloClient( | |
api_key=API_KEY, | |
api_secret=API_SECRET, | |
token=TOKEN | |
) | |
board = client.list_boards()[BOARD_NO] | |
list_id = board.list_lists()[LIST_NO].id | |
my_list = board.get_list(list_id) | |
cards = my_list.list_cards() | |
attachments = [] | |
for card in cards: | |
attachments.append(card.get_attachments()[0].url) | |
for url in attachments: | |
filename = url.split('/')[-1] | |
r = requests.get(url, allow_redirects=True) | |
open(filename, 'wb').write(r.content) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
for today, 2023, Idk why the attachment URL does not have the file extension, but this workaround worked for me.