Skip to content

Commit 07bb410

Browse files
committed
print page link
1 parent bfd4cdc commit 07bb410

File tree

1 file changed

+7
-11
lines changed

1 file changed

+7
-11
lines changed

src/main.py

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,9 @@
2020
with open(join(workspace, envs['from'])) as f:
2121
md = f.read()
2222

23-
current = requests.get(
24-
f"https://{envs['cloud']}.atlassian.net/wiki/rest/api/content/{envs['to']}",
25-
auth=(envs['user'], envs['token'])
26-
).json()
23+
url = f"https://{envs['cloud']}.atlassian.net/wiki/rest/api/content/{envs['to']}"
24+
25+
current = requests.get(url, auth=(envs['user'], envs['token'])).json()
2726

2827
html = markdown(md, extensions=[GithubFlavoredMarkdownExtension()])
2928
content = {
@@ -39,10 +38,7 @@
3938
}
4039
}
4140

42-
updated = requests.put(
43-
f"https://{envs['cloud']}.atlassian.net/wiki/rest/api/content/{envs['to']}",
44-
json=content,
45-
auth=(envs['user'], envs['token'])
46-
).json()
47-
48-
print(updated)
41+
updated = requests.put(url, json=content, auth=(
42+
envs['user'], envs['token'])).json()
43+
link = updated['_links']['base'] + updated['_links']['webui']
44+
print(f'Uploaded content successfully to page {link}')

0 commit comments

Comments
 (0)