429 Client Error

hemaswapnika_e July 3, 2024

I am getting 429 client error when using atlassian-python-api library with the below code:

 

confluence = Confluence(
    url=confluence_base_url,
    token=personal_access_token,   
)
page = confluence.get_page_by_id(page_id, expand='body.storage')
Error:
429 Client Error: Unknown reason for url:https:xxxx/confluence/rest/api/content/page_id?expand=body.storage

1 answer

0 votes
Jim Knepley - ReleaseTEAM
Atlassian Partner
July 3, 2024

A 429 response is in response to hitting a rate limit.

https://developer.atlassian.com/cloud/jira/platform/rate-limiting/

hemaswapnika_e July 3, 2024

Hi Jim,

Should we need to do any configuration in the confluence page or any code implementation needs to be done regarding rate limit.

Pls suggest

Jim Knepley - ReleaseTEAM
Atlassian Partner
July 4, 2024

It looks like the Confluence API has a retry mechanism built in. When you create the Confluence object, do this:

confluence = Confluence(
    url=confluence_base_url,
    token=personal_access_token,   
    backoff_and_retry=True
)

 

From the source code:

backoff_and_retry: Enable exponential backoff and retry. This will retry the request if there is a predefined failure. Primarily designed for Atlassian Cloud where API limits are commonly hit if doing operations on many issues, and the limits require a cooling off period. The wait period before the next request increases exponentially with each failed retry. Defaults to False.


Also consider tuning max_backoff_seconds and max_backoff_retries, but the defaults are probably fine.

Like Antoine _Klee Group_ likes this
hemaswapnika_e July 4, 2024

 

Thanks

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
TAGS
AUG Leaders

Atlassian Community Events