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

Handle repos with missing licenses #1073

Closed
Powersource opened this issue Mar 28, 2019 · 3 comments
Closed

Handle repos with missing licenses #1073

Powersource opened this issue Mar 28, 2019 · 3 comments
Labels

Comments

@Powersource
Copy link

Right now if you call repo.get_license() on a repo that doesn't even have a license file, you get an exception: github.GithubException.UnknownObjectException: 404 {'message': 'Not Found', 'documentation_url': 'https://developer.github.com/v3/licenses/#get-the-contents-of-a-repositorys-license'}.

Personally, I would prefer to just get a None returned instead. Idk what's most pythonic?

@Powersource
Copy link
Author

The proper way seems to be to return 'NONE'.

@sfdye
Copy link
Member

sfdye commented Apr 12, 2019

Understand your concern, but PyGithub is just wrapper for Github REST v3:
https://developer.github.com/v3/licenses/#get-the-contents-of-a-repositorys-license

If a license is matched, the license key and name returned conforms to the SPDX specification.

When there is no license, Github indeed returns a 404. Guess you will have to catch this exception in your code.

@stale
Copy link

stale bot commented Jun 11, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Jun 11, 2019
@stale stale bot closed this as completed Jun 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants