-
Notifications
You must be signed in to change notification settings - Fork 0
/
GetTrelloList.py
58 lines (48 loc) · 1.42 KB
/
GetTrelloList.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# This code sample uses the 'requests' library:
# http://docs.python-requests.org
import requests
import json
import codecs
import os
import configparser
from datetime import date
config = configparser.ConfigParser()
config.read('config.ini')
url = "https://api.trello.com/1/lists/" + config['Trello']['ListId'] + "/cards"
query = {
'key': config['Trello']['Key'],
'token': config['Trello']['Token']
}
response = requests.request(
"GET",
url,
params=query
)
#print(response.text)
cards = json.loads(response.text)
if os.path.exists("index.md"):
os.remove("index.md")
f = codecs.open("index.md", "a", "utf-8")
# Version Params (change these)
version = "1.25.0"
lang = "de"
today = date.today()
date = today.strftime("%d.%m.%Y")
# Header
f.write("---\n")
f.write("title: MiData Release Notes " + version + "\n")
f.write("date: '" + date + "'\n")
f.write("categories: '" + version.rsplit('.', 1)[0] + "'\n")
f.write("slug: " + version.replace(".", "-") + "\n")
f.write("lang: " + lang + "\n")
f.write("---\n\n")
# Features
for card in cards:
f.write("# " + card['name'] + "\n")
description = card['desc'].replace("*in", "\*in")
description = description.replace("\\\\*in", "\*in")
description = description.replace("der*die", "der\*die")
description = description.replace("die*der", "die\*der")
f.write(description + "\n\n")
f.write("[Mehr informationen](" + card['shortUrl'] + ")\n\n")
f.close()