Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

howfairis fails to detect open repository #36

Open
sdruskat opened this issue Oct 9, 2020 · 2 comments
Open

howfairis fails to detect open repository #36

sdruskat opened this issue Oct 9, 2020 · 2 comments

Comments

@sdruskat
Copy link

sdruskat commented Oct 9, 2020

To reproduce:

howfairis https://github.com/hexatomic/hexatomic

See https://github.com/hexatomic/hexatomic, which is an open repository :).

I would expect to get a checkmark for that.

grafik

@jspaaks
Copy link
Member

jspaaks commented Oct 12, 2020

Hi Stephan, thanks for filing the report. Indeed this behavior is misleading. I think what's happening is a HttpError 429 (too many requests), because it also doesn't identify the license even though it should. In any case if I run the same, it seems to work without problems.

I wonder what would be the best way to deal with this? I'm leaning towards implementing throttling based on x-rate-limit property from the HTTP headers. Or maybe requests can do this already.

Or, something like https://pypi.org/project/ratelimit/ maybe.

@sdruskat
Copy link
Author

Thanks Jurriaan. Can confirm that it worked fine now when I tried it again.

Working with x-rate-limit makes sense to me. I've found one old project which is now archived and has verbosely wrapped requests to handle this but isn't of much use. Easier to go with the example from the requests docs directly I think:

The last thing I want to know is how much of my ratelimit I’ve used. Let’s find out. GitHub sends that information in the headers, so rather than download the whole page I’ll send a HEAD request to get the headers.

>>> r = requests.head(url=url, auth=auth)
>>> print(r.headers)
...
'x-ratelimit-remaining': '4995'
'x-ratelimit-limit': '5000'
...

Excellent. Time to write a Python program that abuses the GitHub API in all kinds of exciting ways, 4995 more times.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants