rate Limit Host
An OkHttp interceptor that handles given url host's rate limiting.
Examples:
httpUrl = "https://api.anime.com".toHttpUrl(), permits = 5, period = 1.seconds => 5 requests per second to api.anime.com httpUrl = "https://cdn.thumbnails.com".toHttpUrl(), permits = 10, period = 2.minutes => 10 requests per 2 minutes to cdn.thumbnails.com
Since
extension-lib 14
Parameters
HttpUrl The url host that this interceptor should handle. Will get url's host by using HttpUrl.host()
Int Number of requests allowed within a period of units.
Duration The limiting duration. Defaults to 1.seconds.
An OkHttp interceptor that handles given url host's rate limiting.
Examples:
url = "https://api.anime.com", permits = 5, period = 1.seconds => 5 requests per second to api.anime.com url = "https://cdn.thumbnails.com", permits = 10, period = 2.minutes => 10 requests per 2 minutes to cdn.thumbnails.com
Since
extension-lib 14
Parameters
String The url host that this interceptor should handle. Will get url's host by using HttpUrl.host()
Int Number of requests allowed within a period of units.
Duration The limiting duration. Defaults to 1.seconds.
Deprecated
Use the version with kotlin.time APIs instead.
An OkHttp interceptor that handles given url host's rate limiting.
This uses Java Time APIs and is the legacy method, kept for compatibility reasons with existing extensions.
Examples:
httpUrl = "https://api.anime.com".toHttpUrl(), permits = 5, period = 1, unit = seconds => 5 requests per second to api.anime.com httpUrl = "https://cdn.thumbnails.com".toHttpUrl(), permits = 10, period = 2, unit = minutes => 10 requests per 2 minutes to cdn.thumbnails.com
Since
extension-lib 13