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 am doing API calls to a REST API that supports etag and conditional requests using If-None-Match. Here is some pseudo code:
rate_limit("api")
response=httpx.get(...)
ifresponse.status_code==304:
# In this case my request was not counted against the rate limit by the API provider returncached_responseelse:
returnresponse
Since I need to use rate_limit before my API call, I already consumed one slot before I even know if I'd need to. So in case 304 is returned, I need to release the active slot I erroneously occupied.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I am doing API calls to a REST API that supports
etag
and conditional requests usingIf-None-Match
. Here is some pseudo code:Since I need to use
rate_limit
before my API call, I already consumed one slot before I even know if I'd need to. So in case 304 is returned, I need to release the active slot I erroneously occupied.Is there any API call to do so?
Beta Was this translation helpful? Give feedback.
All reactions