Upload list_github.py
Browse files- list_github.py +17 -0
list_github.py
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import urllib.request, json, sys
|
| 2 |
+
|
| 3 |
+
def list_repo(owner, repo):
|
| 4 |
+
url = f'https://api.github.com/repos/{owner}/{repo}/git/trees/main?recursive=1'
|
| 5 |
+
try:
|
| 6 |
+
with urllib.request.urlopen(url) as resp:
|
| 7 |
+
data = json.loads(resp.read().decode())
|
| 8 |
+
for item in data.get('tree', []):
|
| 9 |
+
print(item['path'])
|
| 10 |
+
except Exception as e:
|
| 11 |
+
print(f'Error: {e}')
|
| 12 |
+
|
| 13 |
+
list_repo('ticketguy', 'littlefig')
|
| 14 |
+
print('---LILA---')
|
| 15 |
+
list_repo('ticketguy', 'Lila')
|
| 16 |
+
print('---EMBERS---')
|
| 17 |
+
list_repo('ticketguy', 'embers-diaries')
|