I want to transfer label_count and card_m to my main flask python file. How do I do that? I already tried importing it it didn't work. And if there is any solution to card_m I don't want repeat request so many times
import requests
import json
from itertools import chain
from collections import Counter
url = "https://api.trello.com/1/boards/OIeEN1vG/cards"
query = {
'key': 'e8cac9f95a86819d54194324e95d4db8',
'token': 'aee28b52f9f8486297d8656c82a467bb4991a1099e23db539604ac35954d5633'
}
response = requests.request(
"GET",
url,
params=query
)
data = response.json()
card_labels_string = list(chain.from_iterable([d['labels']for d in data]))
card_labels = [c ["color"] for c in card_labels_string]
label_count = dict((i, card_labels.count(i)) for i in card_labels)
cards = dict(zip([d['name']for d in data],[d['shortLink']for d in data]))
card_m = {}
for key,value in cards.items():
url_card = "https://api.trello.com/1/cards/{}/members".format(value)
res = requests.request(
"GET",
url_card,
params=query
)
names = [f['fullName']for f in res.json()]
card_m.update({key : names})
print(label_count, card_m)