print page link

This commit is contained in:
cupcakearmy 2020-12-13 16:53:16 +01:00
parent bfd4cdc043
commit 07bb4100ed
No known key found for this signature in database
GPG Key ID: 81C683415BBD86B0

View File

@ -20,10 +20,9 @@ for key in ['from', 'to', 'cloud', 'user', 'token']:
with open(join(workspace, envs['from'])) as f: with open(join(workspace, envs['from'])) as f:
md = f.read() md = f.read()
current = requests.get( url = f"https://{envs['cloud']}.atlassian.net/wiki/rest/api/content/{envs['to']}"
f"https://{envs['cloud']}.atlassian.net/wiki/rest/api/content/{envs['to']}",
auth=(envs['user'], envs['token']) current = requests.get(url, auth=(envs['user'], envs['token'])).json()
).json()
html = markdown(md, extensions=[GithubFlavoredMarkdownExtension()]) html = markdown(md, extensions=[GithubFlavoredMarkdownExtension()])
content = { content = {
@ -39,10 +38,7 @@ content = {
} }
} }
updated = requests.put( updated = requests.put(url, json=content, auth=(
f"https://{envs['cloud']}.atlassian.net/wiki/rest/api/content/{envs['to']}", envs['user'], envs['token'])).json()
json=content, link = updated['_links']['base'] + updated['_links']['webui']
auth=(envs['user'], envs['token']) print(f'Uploaded content successfully to page {link}')
).json()
print(updated)