howfairis-github-action icon indicating copy to clipboard operation
howfairis-github-action copied to clipboard

howfairis fails to detect open repository

Open sdruskat opened this issue 5 years ago • 2 comments

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

sdruskat avatar Oct 09 '20 09:10 sdruskat

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.

jspaaks avatar Oct 12 '20 08:10 jspaaks

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.

sdruskat avatar Oct 27 '20 15:10 sdruskat