From 07bb4100ed1414823d250cf907386d47a93c6a9d Mon Sep 17 00:00:00 2001 From: cupcakearmy Date: Sun, 13 Dec 2020 16:53:16 +0100 Subject: [PATCH] print page link --- src/main.py | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/src/main.py b/src/main.py index cfa8275..d0edf70 100644 --- a/src/main.py +++ b/src/main.py @@ -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 = { @@ -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}')