Skip to content

Instantly share code, notes, and snippets.

@jgworks
Created February 11, 2015 21:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jgworks/a5575882f182fc2273ee to your computer and use it in GitHub Desktop.
Save jgworks/a5575882f182fc2273ee to your computer and use it in GitHub Desktop.
#!/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