Conversation
401 errors are caused when the OTP expires from a long session. The way the code is currently organized, it isn't easy to re-ask for it, so for now we just print a message to try again. This generally only happens if the user does something in the middle of running doctr configure, such as going to enable Travis on the repo. If everything is already configured, a single session is generally short enough to use the same OTP code. 403 errors occur when the GitHub API rate limit is hit. This can happen when unauthenticated requests are used (i.e., --no-upload-key), as the limit is 60 global GitHub API requests per IP per hour. For authenticated requests, the limit is 5000 requests per hour, but this is shared across all oauth applications. It seems that the Travis "sync account" button consistently causes this limit to be hit if you have access to many repos (for instance, if you are a member of the conda-forge organization). So if a user goes to enable a repo on Travis, then runs doctr configure, they will hit this error. doctr configure now prints an error message indicating that the rate limit has been hit and how long it will be until it resets. Unfortunately, there is not much else we can do here. Fixes #311.
Member
Author
|
Note for anyone testing this, the messages will actually print in red once this and #310 are merged together. |
Member
Author
|
We can also activate repositories on Travis via the API https://developer.travis-ci.com/resource/repository#activate. We should probably offer to do this if a repo exists but isn't activated on Travis yet. |
moorepants
reviewed
Aug 28, 2018
| Your rate limits will reset in {s}.\ | ||
| """.format(s=s) | ||
| raise GitHubError(message) | ||
| r.raise_for_status() |
Contributor
There was a problem hiding this comment.
This all seems clear to me. Should be very helpful.
Member
Author
|
I was playing around with doing that, and I hit the API limit again. So I'm not sure but it looks like Travis might hit the GitHub API limits even if you try to activate a repo manually via the API. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
401 errors are caused when the OTP expires from a long session. The way the
code is currently organized, it isn't easy to re-ask for it, so for now we
just print a message to try again. This generally only happens if the user
does something in the middle of running doctr configure, such as going to
enable Travis on the repo. If everything is already configured, a single
session is generally short enough to use the same OTP code.
403 errors occur when the GitHub API rate limit is hit. This can happen when
unauthenticated requests are used (i.e., --no-upload-key), as the limit is 60
global GitHub API requests per IP per hour. For authenticated requests, the
limit is 5000 requests per hour, but this is shared across all oauth
applications. It seems that the Travis "sync account" button consistently
causes this limit to be hit if you have access to many repos (for instance, if
you are a member of the conda-forge organization). So if a user goes to enable
a repo on Travis, then runs doctr configure, they will hit this error.
doctr configure now prints an error message indicating that the rate limit has
been hit and how long it will be until it resets. Unfortunately, there is not
much else we can do here.
Fixes #311.