confluence = Confluence(url=conf_site, username=conf_user, password=conf_passwd)
pg = confluence.get_page_by_id(page_id, expand='body.storage')
pg_content = pg['body']
pg_content = pg['body'] throws error as:
page_content = page['body']
TypeError: string indices must be integers
Can you please help me to fix this issue?
Hi @Rajesh Vr
Welcome to the Atlassian Community.
Can you please try
pg_content = pg.body instead of pg_content = pg['body']
Cheers,
Peter
Ok,
So basically pg is your body content in json format then already.
Can you try using the json python library like explained here: https://www.w3schools.com/python/python_json.asp
To turn this string into a dictionary?
Cheers,
Peter
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I tried the json, but with no luck :-(
p = json.loads(page) itself throws json Decode error.
Then I directly used: table = pandas.read_html(page) which throws error:
raise ValueError("No tables found")
ValueError: No tables found
My goal is to read a table from confluence page and update.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hey @Rajesh Vr ,
Just asking for the full code isn't really going to help you learn and expand your Python and Confluence knowledge. It's not how we do things in the community. We focus on supporting people with their learning efforts.
So take a look at these links for inspiration on how to potentially solve your problem:
I hope they help.
Cheers,
Peter
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hello @Peter Van de Voorde ,
I had already referred the first link in your list, and researched a few more similar sites, but without success.
Let me now try using REST APIs directly after referring other links in your list. I will update here in case I have something to share.
cheers,
-Rajesh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.