jcabi / jcabi/jcabi-github

Pagination and Rate limit

Open
#1,283 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
307
Forks
144
Avg merge
1d 22h
Merged PRs (30d)
14

Description

Hi,

How can I control how many results I get at the same time?
My call is
```
String twoDaysAgo = ZonedDateTime.now().minusDays(2).format( DateTimeFormatter.ISO_INSTANT );
enumMap.put(Issues.Qualifier.SINCE, now);
Iterable issuesIterator = repo.issues().search(Issues.Sort.UPDATED, Search.Order.DESC, enumMap );
issuesIterator.iterator().forEachRemaining(i -> System.out.println(i.label()));

```

And then I'm getting the error:
```
{"message":"API rate limit exceeded for 122.XXX.XXX.XXX. (But here's the good news: Authenticated requests get a higher rate limit. Check out the documentation for more details.)","documentation_url":"https://developer.github.com/v3/#rate-limiting"}>
at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:20)
at com.jcabi.http.response.RestResponse.assertStatus(RestResponse.java:111)
at com.jcabi.github.RtValuePagination$Items.fetch(RtValuePagination.java:193)
at com.jcabi.github.RtValuePagination$Items.hasNext(RtValuePagination.java:179)
at java.util.Iterator.forEachRemaining(Iterator.java:115)
```

1) How can I specify the page size to be 100 ? (max authorised)
2) How can I throttle my iteratable to respect the rate limiting? This should be done under the hood ideally?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.