You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
The text was updated successfully, but these errors were encountered:
You should have the response headers in the transport.response_headers attribute, so you could get the value you're looking for in transport.response_headers["Retry-After"]
This is already working with the RequestsHTTPTransport but for the AIOHTTPTransport the response headers were only saved if there was no error.
The PR #367 should fix this for this transport as well.
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:
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
The text was updated successfully, but these errors were encountered: