The Atlassian Community Forums are currently in read-only mode. We will be relaunching on a new platform on September 22 (read more here). We apologize for the extended downtime. For concerns or questions, please email communitymanagers@atlassian.com. See you on the other side, on the new Atlassian Community Forums! :)

×

Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

why i could not run the official code

KAI HUA CHE
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
August 15, 2024

when i run this code:

 

def get_page_body(staff_id,pwd,page_id):
    confluenceAPI = "https://wpb-confluence.systems.uk.hsbc/rest/api/content/"+page_id+"?expand=body.storage"
    HEADERS = {'Content-Type': 'application/json','Authorization':f'Basic {api_key}'}
    requests.DEFAULT_RETRIES = 100
    session = requests.session()
    response = session.get(confluenceAPI, auth=(staff_id, pwd), headers=HEADERS, verify=True)
    result = json.loads(response.text)
    return result
It says JSONDecodeError: Expecting value: line 1 column 1 (char 0).
In the past time i could run it successfully but now i can not. Why?

1 answer

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

0 votes
Yong Yang
Community Champion
August 19, 2024

Hi @KAI HUA CHE 

Welcome to our community.

Is it a Python code to access Confluence datacenter product? The JSONDecodeError: Expecting value: line 1 column 1 (char 0) error typically occurs when the response body you're trying to decode as JSON is either empty or not in JSON format.

Hope it helps.

Thanks,

YY哥

TAGS
AUG Leaders

Atlassian Community Events