Skip to content

Commit 9754be0

Browse files
authored
Add files via upload
1 parent a3117b5 commit 9754be0

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

Diff for: AutomationScripts/Github Bot/github_bot.py

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
from github import Github
2+
#user login
3+
g=Github("username","password")
4+
5+
6+
#showing all the repositories of python
7+
repos= g.search_repositories(query="language:python")
8+
for i in repos:
9+
print(i)
10+
11+
#for getting all the repos of user
12+
for repo in g.get_user().get_repos():
13+
print(repo.name)
14+
15+
#shows the no. of star of the repo
16+
repo=g.get_repo("repository name")
17+
repo.stargazers_count
18+
19+
#getting all the contents of particular repo
20+
content=repo.get_contents("")
21+
for content_fil in content:
22+
print(content_fil)
23+
24+
#making a repo test and creating test file
25+
user= g.get_user()
26+
repo=user.create_repo('test')
27+
repo.create_file("test.txt","commit","hello coders")
28+
29+
#deleting file from the repo
30+
repo=g.get_repo("")#enter repository name inside the bracket
31+
cont=repo.get_contents("test.txt")
32+
repo.delete_file(cont.path,"remove test",cont.sha,branch='master')

0 commit comments

Comments
 (0)