pygithub

trying to access Github issue comments using PyGithub library

感情迁移 提交于 2019-12-08 03:12:08
问题 I am trying to access issue comments using PyGithub library. this is the function which I implemented, def get_issue_comments_dict(self, repository): """ get issue comments outputs reponame: issue title, issue url, comments Return type: dict """ repo = self.user_obj.get_repo(repository) issues = repo.get_issues() issues_dict = {} i = 1 for issue in issues: issue_dict = {} issue_dict['url'] = issue.url issue_dict['title'] = issue.title issue_dict['comments'] = [comment for comment in issue.get

trying to access Github issue comments using PyGithub library

南笙酒味 提交于 2019-12-06 14:54:25
I am trying to access issue comments using PyGithub library. this is the function which I implemented, def get_issue_comments_dict(self, repository): """ get issue comments outputs reponame: issue title, issue url, comments Return type: dict """ repo = self.user_obj.get_repo(repository) issues = repo.get_issues() issues_dict = {} i = 1 for issue in issues: issue_dict = {} issue_dict['url'] = issue.url issue_dict['title'] = issue.title issue_dict['comments'] = [comment for comment in issue.get_issue_comments()] issues_dict[i] = issue_dict i += 1 return issues_dict and this is the error which I

How to get all user repositories by github api? (including Pinned repositories)

大城市里の小女人 提交于 2019-12-06 12:01:35
问题 I' trying get all user's repositories by using PyGithub . For clarity the user: https://github.com/mbostock has 53 public repos. my code: import github con = github.Github(mylogin, pass) u = g.get_user('mbostock').get_repos('all') and I get 53, It's correct number but, I have noticed that among all received repos I can't find some user's Pinned repositories , for example d3/d3 , although that user also make big contribution on this repo. If somebody know github api, and way of receiving all

How to create a file inside a repository using PyGithub?

两盒软妹~` 提交于 2019-12-06 10:26:16
问题 As the documentation suggests, calling create_file on a github.Repository.Repository object should create a file but I am getting github.GithubException.UnknownObjectException . My code is like this: `repo.create_file('filename', 'commitmessage', 'content')` What am I doing wrong? 回答1: It seems that you need to start the filename with a slash / . I've tried the following command, and it worked: In [12]: repo.create_file('/filename', 'commitmessage', 'content') Out[12]: {'commit': Commit(sha=

How to get all user repositories by github api? (including Pinned repositories)

心已入冬 提交于 2019-12-04 15:32:50
I' trying get all user's repositories by using PyGithub . For clarity the user: https://github.com/mbostock has 53 public repos. my code: import github con = github.Github(mylogin, pass) u = g.get_user('mbostock').get_repos('all') and I get 53, It's correct number but, I have noticed that among all received repos I can't find some user's Pinned repositories , for example d3/d3 , although that user also make big contribution on this repo. If somebody know github api, and way of receiving all user's contributed repos, please help. Not all of the user's pinned repositories belong to that user

How to create a file inside a repository using PyGithub?

旧街凉风 提交于 2019-12-04 14:06:30
As the documentation suggests, calling create_file on a github.Repository.Repository object should create a file but I am getting github.GithubException.UnknownObjectException . My code is like this: `repo.create_file('filename', 'commitmessage', 'content')` What am I doing wrong? It seems that you need to start the filename with a slash / . I've tried the following command, and it worked: In [12]: repo.create_file('/filename', 'commitmessage', 'content') Out[12]: {'commit': Commit(sha="201e0e5b91f7ec431d5b06cc47affff202e3de04"), 'content': ContentFile(path="filename")} 来源: https:/

How to create a new repository in an organization with PyGithub

霸气de小男生 提交于 2019-12-01 13:10:43
问题 How can I create a new repository in an organization with PyGithub on Github? In particular I like to know how to use the create_repo method? My question is identical to this question, but I would like the created repository to appear in an organization. The solution to creating a repo without the organization level is: g = Github("username", "password") user = g.get_user() repo = user.create_repo(full_name) 回答1: This link gave me the answer: link I thought I would update my question to let

How do I push new files to GitHub?

孤街醉人 提交于 2019-11-27 14:48:58
问题 I created a new repository on github.com and then cloned it to my local machine with git clone https://github.com/usrname/mathematics.git I added 3 new files under the folder mathematics $ tree . ├── LICENSE ├── numerical_analysis │ └── regression_analysis │ ├── simple_regression_analysis.md │ ├── simple_regression_analysis.png │ └── simple_regression_analysis.py Now, I'd like to upload 3 new files to my GitHub using Python, more specifically, PyGithub. Here is what I have tried: #!/usr/bin