Skip to content

Commit

Permalink
print page link
Browse files Browse the repository at this point in the history
  • Loading branch information
cupcakearmy committed Dec 13, 2020
1 parent bfd4cdc commit 07bb410
Showing 1 changed file with 7 additions and 11 deletions.
18 changes: 7 additions & 11 deletions src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,9 @@
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 = {
Expand All @@ -39,10 +38,7 @@
}
}

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}')

0 comments on commit 07bb410

Please sign in to comment.