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

0 votes
YY Brother
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哥

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events