Created
February 11, 2015 21:07
-
-
Save jgworks/a5575882f182fc2273ee to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# | |
# Reads from standard input, dumps it onto a Confluence page | |
# You'll need to modify the URL/username/password/spacekey/page title | |
# below, because I'm too lazy to bother with argv. | |
import sys | |
import ssl | |
from xmlrpclib import Server | |
def update_page(username, pw): | |
# Read the text of the page from standard input | |
content = sys.stdin.read() | |
context = ssl.SSLContext(ssl.PROTOCOL_SSLv23) | |
try: | |
s = Server("https://confluence.example.com/rpc/xmlrpc", context) | |
except AttributeError: | |
s = Server("https://confluence.example.com/rpc/xmlrpc") | |
token = s.confluence2.login(username, pw) | |
page = s.confluence2.getPage(token, "SPACEKEY", "PAGE TITLE") | |
# change the content here | |
page['content'] = content | |
s.confluence2.storePage(token, page) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment