Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit52cea88

Browse files
committed
added new script, updated readme, updated todo:
1 parent14147e3 commit52cea88

File tree

3 files changed

+45
-0
lines changed

3 files changed

+45
-0
lines changed

‎TODO.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,5 @@
22
1. Add Travis
33
1. Add support for Python 2.7, 3.5, and 3.6
44
1. Organize docs and folder structure better
5+
1. Add all scripts to single CLI for easy running, testing, and searching
6+
1. Add License

‎readme.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,4 @@
3232
1.**30_fullcontact.py**: Call the[FullcContact](https://www.fullcontact.com/developer/) API
3333
1.**31_youtube_sentiment.py**: Calculate sentiment score from the comments of a Youtube video
3434
1.**32_stock_scraper.py**: Get stock prices
35+
1.**34_git_all_repos.py**: Clone all repositories from a public user or organization on Github. Usage:`python git_all_repos.py users USER_NAME` or`python git_all_repos.py orgs ORG_NAME`

‎scripts/34_git_all_repos.py

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
importsys
2+
importos
3+
importrequests
4+
5+
6+
defget_total_repos(group,name):
7+
repo_urls= []
8+
page=1
9+
whileTrue:
10+
url='https://api.github.com/{0}/{1}/repos?per_page=100&page={2}'
11+
r=requests.get(url.format(group,name,page))
12+
ifr.status_code==200:
13+
rdata=r.json()
14+
forrepoinrdata:
15+
repo_urls.append(repo['clone_url'])
16+
if (len(rdata)>=100):
17+
page+=1
18+
else:
19+
print('Found {0} repos.'.format(len(repo_urls)))
20+
break
21+
else:
22+
print(r)
23+
returnFalse
24+
returnrepo_urls
25+
26+
27+
defclone_repos(all_repos):
28+
count=1
29+
print('Cloning...')
30+
forrepoinall_repos:
31+
os.system('Git clone '+repo)
32+
print('Completed repo #{0} of {1}'.format(count,len(all_repos)))
33+
count+=1
34+
35+
if__name__=='__main__':
36+
iflen(sys.argv)>2:
37+
total=get_total_repos(sys.argv[1],sys.argv[2])
38+
iftotal:
39+
clone_repos(total)
40+
41+
else:
42+
print('Usage: python USERS_OR_ORG GITHUB_USER_OR_ORG-NAME')

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp