Accessing Confluence from python

Hi,

I am trying to connect to a confluence but get this error [WinError 10061] No connection could be made because the target machine actively refused it.

Below, you'll find the code I am using.

Thank you in advance for your precious help.

 

from xmlrpc import client

CONFLUENCE_URL = "my-confluence-url/rpc/xmlrpc" #
CONFLUENCE_LOGIN = "login"
CONFLUENCE_PASSWORD = "pwd"

# get this from the page url while editing
# e.g. ../editpage.action?pageId=132350005 <-- here
PAGE_ID = "1234"


# and write the new contents
client2 = client.Server(CONFLUENCE_URL, verbose=1)

auth_token = client2.confluence2.login(CONFLUENCE_LOGIN, CONFLUENCE_PASSWORD)
page = client2.confluence2.getPage(auth_token, PAGE_ID)
##
page['content'] = "!!!your content here!!!"
##
result = client2.confluence2.storePage(auth_token, page)
client2.confluence2.logout(auth_token)

print("modification Done.")

 

 

1 answer

1 accepted

Hi Anass,

I didn't look your code over too closely, but it seems OK. Did you check to make sure that your Confluence URL is right? Sometimes Confluence has a context path (for example, all Confluence Cloud instances have a content path of "/wiki", which means that the Confluence URL is actually xxxx.atlassian.net/wiki). From the error message, it sounds like that might be the problem.

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Kesha Thillainayagam
Posted Apr 13, 2018 in Confluence

We want to hear how your non-technical teams are using Confluence!

Hi Community! Kesha (kay-sha) from the Confluence marketing team here! Can you share stories with us on how your non-technical (think Marketing, Sales, HR, legal, etc.) teams are using Confluen...

355 views 20 10
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you