Emmanuel Emmanuel - 6 months ago 104
Python Question

Modify wiki page (Confluence) programmatically

I'd like to modify a wiki page (Confluence by Atlassian - JIRA editors) programmatically (in python). What I tried so far is to simulate user behaviour:


  1. click on Edit button

  2. change content of a
    textarea
    input

  3. submit changes with Save button



Part 1 is ok since I have the URL corresponding to an edit of the page, part 2 (retrieval of the page and modification) is ok too, but I don't know how to achieve step 3... I'm using
urllib2
.

Thanks for your help !!

EDIT: XML-RPC is indeed the solution, this example does exactly what I want !

Answer

This seems like the absolutely wrong way to go about it.

First off, Confluence has a plugin architecture which should allow you to manage content programmatically from the application itself without any kind of HTTP requests. Secondly, even if you don't want to, or can't, use the plugin API for some reason, the next obvious option is to use the SOAP/XML-RPC API.

There is no reason to actually mess with buttons and textareas unless you're trying to do some kind of end-to-end test that includes testing GUI (e.g. automated cross-browser testing).

Comments