RateLimitStatus#

class gafaelfawr.models.userinfo.RateLimitStatus(limit, used, remaining, reset, resource)#

Bases: object

Current status of rate limiting for a user for one API.

This is an internal model used to hold rate limiting status information that will be returned to the user in HTTP headers. It represents a fixed window rate limit algorithm.

Parameters:

Attributes Summary

limit

Total number of API requests allowed to this service.

remaining

Number of API requests remaining in the rate limit period.

reset

Time at which the rate limit window will reset.

resource

Name of the resource being rate limited (the API service name).

used

Number of API requests used in the rate limit period.

Methods Summary

to_http_headers()

Return the rate limit status as HTTP headers.

Attributes Documentation

limit: int = <dataclasses._MISSING_TYPE object>#

Total number of API requests allowed to this service.

remaining: int = <dataclasses._MISSING_TYPE object>#

Number of API requests remaining in the rate limit period.

reset: datetime = <dataclasses._MISSING_TYPE object>#

Time at which the rate limit window will reset.

resource: str = <dataclasses._MISSING_TYPE object>#

Name of the resource being rate limited (the API service name).

used: int = <dataclasses._MISSING_TYPE object>#

Number of API requests used in the rate limit period.

Methods Documentation

to_http_headers()#

Return the rate limit status as HTTP headers.

The headers were chosen to match the GitHub rate limit implementation.

Return type:

dict[str, str]