Skip to content

Error 429: catch Retry-After #366

Closed
Closed
@Hadevmin

Description

@Hadevmin

I would like to know how exploit the return of the server when an error 429 occurs.

I use this template to perform my gql requests:

        async with Client(transport=transport) as session:
            query = gql(query)
            params = {params}
            try:
                result = await session.execute(query, variable_values=params)
            except TransportServerError:
                time.sleep(x_seconds)

I would like to set the x_seconds with the return of the server.

Whenever you perform too many requests, the server will answer with a 429 HTTP error code and add a 'Retry-After: TimeToWaitInSeconds' header to the response. (RFC: https://datatracker.ietf.org/doc/html/rfc6585#section-4)

Should I use the requests library to catch this parameter or can I use the gql library to catch it?

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: bugAn issue or pull request relating to a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions