mirror of
https://github.com/cupcakearmy/confluence-markdown-sync.git
synced 2024-12-22 16:06:25 +00:00
print page link
This commit is contained in:
parent
bfd4cdc043
commit
07bb4100ed
18
src/main.py
18
src/main.py
@ -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)
|
|
||||||
|
Loading…
Reference in New Issue
Block a user