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:
md = f.read()
current = requests.get(
f"https://{envs['cloud']}.atlassian.net/wiki/rest/api/content/{envs['to']}",
auth=(envs['user'], envs['token'])
).json()
url = f"https://{envs['cloud']}.atlassian.net/wiki/rest/api/content/{envs['to']}"
current = requests.get(url, auth=(envs['user'], envs['token'])).json()
html = markdown(md, extensions=[GithubFlavoredMarkdownExtension()])
content = {
@ -39,10 +38,7 @@ content = {
}
}
updated = requests.put(
f"https://{envs['cloud']}.atlassian.net/wiki/rest/api/content/{envs['to']}",
json=content,
auth=(envs['user'], envs['token'])
).json()
print(updated)
updated = requests.put(url, json=content, auth=(
envs['user'], envs['token'])).json()
link = updated['_links']['base'] + updated['_links']['webui']
print(f'Uploaded content successfully to page {link}')