@Immutable public final class CarefulWire extends Object implements com.jcabi.http.Wire
Github sets following headers in each response:
X-RateLimit-Limit, X-RateLimit-Remaining, and
X-RateLimit-Reset. If X-RateLimit-Remaining is
less than a given threshold, CarefulWire will sleep until a time
specified in the X-RateLimit-Reset header. For further information
about the Github rate limiting see
API
documentation.
You can use CarefulWire with a Github
object:
Github github = new RtGithub(
new RtGithub().entry().through(CarefulWire.class, 50)
);
| Constructor and Description |
|---|
CarefulWire(com.jcabi.http.Wire wire,
int thrshld)
Public ctor.
|
| Modifier and Type | Method and Description |
|---|---|
com.jcabi.http.Response |
send(com.jcabi.http.Request req,
String home,
String method,
Collection<Map.Entry<String,String>> headers,
InputStream content,
int connect,
int read) |
public CarefulWire(com.jcabi.http.Wire wire,
int thrshld)
wire - Original wirethrshld - Threshold of number of remaining requests, below which
requests are blocked until resetpublic com.jcabi.http.Response send(com.jcabi.http.Request req,
String home,
String method,
Collection<Map.Entry<String,String>> headers,
InputStream content,
int connect,
int read)
throws IOException
send in interface com.jcabi.http.WireIOExceptionCopyright © 2012–2018 jcabi.com. All rights reserved.