-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRepoSize.py
More file actions
31 lines (27 loc) · 871 Bytes
/
RepoSize.py
File metadata and controls
31 lines (27 loc) · 871 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# This script outputs the size for
# each public project on BitBucket
import json, requests
jsonDict = {}
url = 'https://api.bitbucket.org/2.0/repositories/?pagelen=100'
while True:
r = requests.get (url)
t = r.text
jsonDict = json.loads (t)
for myIterator in jsonDict['values']:
(scm, name, size, has_issues, created, updated) = ('', '', '', '', '', '')
for key, value in myIterator.iteritems():
if key == 'scm':
scm = value
if key == 'size':
size = str(value)
if key == 'full_name':
name = value
if key == 'created_on':
created = value
if key == 'updated_on':
updated = value
if key == 'has_issues':
has_issues = str(value)
print size+';'+scm+';'+has_issues+';'+created+';'+updated+';'+name
if 'next' not in jsonDict: break
else: url = jsonDict['next']