It is a memorandum when outputting the repository list using Github API on Mac.
Install PyGithub
$ pip install PyGithub
In addition, get an access token for your GitHub account (you can get it from Settings)
Output repository list
#!/usr/bin/env python
from github import Github
token = 'xxxxxxxxxxxxxxx' # your access token
# or using an access token
g = Github(token)
for repo in g.get_user().get_repos():
print(repo.name)
Run
(Repository list is output)
$ python github.py
Traceback (most recent call last):
File "github.py", line 2, in <module>
from github import Github
File "/Users/seigo/Desktop/python/burger/github.py", line 2, in <module>
from github import Github
ImportError: cannot import name 'Github' from 'github' (/Users/seigo/Desktop/python/burger/github.py)
I get the above error when I name the sample code gitHub.py. Renamed to sample.py and resolved.
PyGithub I tried to summarize various things about Github API I tried to get GitHub information using PyGithub Python 2.7 Error - ImportError: cannot import name Github
Recommended Posts