fair-software / howfairis-github-action

GitHub Action to analyze a GitHub repository’s compliance with the fair-software.eu recommendations.
Apache License 2.0
15 stars 5 forks source link

howfairis fails to detect open repository #36

Open sdruskat opened 3 years ago

sdruskat commented 3 years ago

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 commented 3 years ago

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 commented 3 years ago

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.