dump-github 0.1.4__py3-none-any.whl → 0.1.6__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- dump_github/main.py +17 -8
- {dump_github-0.1.4.dist-info → dump_github-0.1.6.dist-info}/METADATA +5 -4
- dump_github-0.1.6.dist-info/RECORD +10 -0
- dump_github-0.1.4.dist-info/RECORD +0 -10
- {dump_github-0.1.4.dist-info → dump_github-0.1.6.dist-info}/LICENSE +0 -0
- {dump_github-0.1.4.dist-info → dump_github-0.1.6.dist-info}/WHEEL +0 -0
- {dump_github-0.1.4.dist-info → dump_github-0.1.6.dist-info}/entry_points.txt +0 -0
- {dump_github-0.1.4.dist-info → dump_github-0.1.6.dist-info}/top_level.txt +0 -0
dump_github/main.py
CHANGED
|
@@ -2,8 +2,6 @@ import argparse
|
|
|
2
2
|
import os
|
|
3
3
|
from .lib import *
|
|
4
4
|
|
|
5
|
-
# Config_MaxSize = 1_000
|
|
6
|
-
|
|
7
5
|
parser = argparse.ArgumentParser(
|
|
8
6
|
prog="dump-github",
|
|
9
7
|
description="Backup users github repo.",
|
|
@@ -15,7 +13,13 @@ parser.add_argument(
|
|
|
15
13
|
"-d", "--download_zip", action="store_true", help="only download zip file"
|
|
16
14
|
)
|
|
17
15
|
parser.add_argument("-p", "--print", action="store_true", help="only print urls")
|
|
18
|
-
parser.add_argument("
|
|
16
|
+
parser.add_argument("--token", action="store", default="", help="github token")
|
|
17
|
+
parser.add_argument(
|
|
18
|
+
"--limit_size",
|
|
19
|
+
type=int,
|
|
20
|
+
default=100,
|
|
21
|
+
help="limit size(MB) of download zip file, if 0 then no limit(default:100).",
|
|
22
|
+
)
|
|
19
23
|
|
|
20
24
|
args = parser.parse_args()
|
|
21
25
|
|
|
@@ -24,17 +28,22 @@ def clone_repo(repo):
|
|
|
24
28
|
name = repo["name"]
|
|
25
29
|
url = repo["clone_url"]
|
|
26
30
|
size = repo["size"]
|
|
27
|
-
# if int(size) > Config_MaxSize:
|
|
28
|
-
# print(f"Keep repo [{name}], Becues size is too Big ({int(size)}).")
|
|
29
|
-
# return
|
|
30
31
|
print("Clone repo: {}".format(name))
|
|
31
32
|
os.system("git clone {}".format(url))
|
|
32
33
|
|
|
33
34
|
|
|
34
35
|
def download_zip(user_name, reop):
|
|
35
36
|
url = f"https://github.com/{user_name}/{reop['name']}/archive/refs/heads/{reop['default_branch']}.zip"
|
|
36
|
-
|
|
37
|
-
|
|
37
|
+
max_size = args.limit_size * 1000 * 1000
|
|
38
|
+
file_name = f"./{user_name}_{reop['name']}.zip"
|
|
39
|
+
cmd = "curl -L --connect-timeout 5 --retry 3 --retry-delay 3 --max-filesize {} {} -o {}".format(
|
|
40
|
+
max_size, url, file_name
|
|
41
|
+
)
|
|
42
|
+
print(f"Download {reop['name']} : {url}")
|
|
43
|
+
os.system(cmd)
|
|
44
|
+
if os.path.exists(file_name) and max_size < os.stat(file_name).st_size:
|
|
45
|
+
os.remove(file_name)
|
|
46
|
+
print(f"Removed {file_name} because it exceeds the limit size.")
|
|
38
47
|
|
|
39
48
|
|
|
40
49
|
def main():
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: dump-github
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.6
|
|
4
4
|
Summary: This tool can be used to back up users' GitHub repositories in case they need them later.
|
|
5
5
|
Home-page: https://github.com/core2002/dump_github
|
|
6
6
|
Author: core2002
|
|
@@ -21,7 +21,7 @@ Github Dumper is a Python program designed to search for users' GitHub repositor
|
|
|
21
21
|
|
|
22
22
|
**Usage:**
|
|
23
23
|
```
|
|
24
|
-
usage: dump-github [-h] [-d] [-p] [
|
|
24
|
+
usage: dump-github [-h] [-d] [-p] [--token TOKEN] [--limit_size LIMIT_SIZE] username
|
|
25
25
|
|
|
26
26
|
Backup users github repo.
|
|
27
27
|
|
|
@@ -32,8 +32,9 @@ options:
|
|
|
32
32
|
-h, --help show this help message and exit
|
|
33
33
|
-d, --download_zip only download zip file
|
|
34
34
|
-p, --print only print urls
|
|
35
|
-
|
|
36
|
-
|
|
35
|
+
--token TOKEN github token
|
|
36
|
+
--limit_size LIMIT_SIZE
|
|
37
|
+
limit size(MB) of download zip file, if 0 then no limit(default:100).
|
|
37
38
|
|
|
38
39
|
https://github.com/Core2002/dump_github
|
|
39
40
|
```
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
dump_github/__init__.py,sha256=3XLRrchVn7g3TYWiQpv3u2lKdTO-jDqg4_0-lpmRuRs,43
|
|
2
|
+
dump_github/lib.py,sha256=pHONzAjGbXkmAUvCGn8HkHWS7fyY2qu9R17to6jD1TU,715
|
|
3
|
+
dump_github/main.py,sha256=uTPdcVwg0mkmOAGJXpVeBn3m3f7SyNOracyqAnR-KuA,1842
|
|
4
|
+
dump_github/mylib.py,sha256=pHONzAjGbXkmAUvCGn8HkHWS7fyY2qu9R17to6jD1TU,715
|
|
5
|
+
dump_github-0.1.6.dist-info/LICENSE,sha256=5tQa-lQLqvLhjTuELEk4bm70I5hcdjUeOn4qf3MK84E,1064
|
|
6
|
+
dump_github-0.1.6.dist-info/METADATA,sha256=N-GTzKpnXMnd1tsmEiJc7exaO0XEbuJJTuzqiDQemBI,1287
|
|
7
|
+
dump_github-0.1.6.dist-info/WHEEL,sha256=G16H4A3IeoQmnOrYV4ueZGKSjhipXx8zc8nu9FGlvMA,92
|
|
8
|
+
dump_github-0.1.6.dist-info/entry_points.txt,sha256=qbBICoPzzAZRMjmgnFvndjx0SGhF8ji9MsY2F8Isrrs,50
|
|
9
|
+
dump_github-0.1.6.dist-info/top_level.txt,sha256=6oWfdkP2U1AN9zL6AUIUTxe6hYIeo_Nf8M8SWBxElUw,12
|
|
10
|
+
dump_github-0.1.6.dist-info/RECORD,,
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
dump_github/__init__.py,sha256=3XLRrchVn7g3TYWiQpv3u2lKdTO-jDqg4_0-lpmRuRs,43
|
|
2
|
-
dump_github/lib.py,sha256=pHONzAjGbXkmAUvCGn8HkHWS7fyY2qu9R17to6jD1TU,715
|
|
3
|
-
dump_github/main.py,sha256=5cGccpUxt88fiqPf5BPhmxY1vpwdO-8tzIj2KiRSyVs,1506
|
|
4
|
-
dump_github/mylib.py,sha256=pHONzAjGbXkmAUvCGn8HkHWS7fyY2qu9R17to6jD1TU,715
|
|
5
|
-
dump_github-0.1.4.dist-info/LICENSE,sha256=5tQa-lQLqvLhjTuELEk4bm70I5hcdjUeOn4qf3MK84E,1064
|
|
6
|
-
dump_github-0.1.4.dist-info/METADATA,sha256=Hv9Rqxb4uLtI508RNrT50ZBM_xlwx_DpqwfuNXVWnnA,1162
|
|
7
|
-
dump_github-0.1.4.dist-info/WHEEL,sha256=G16H4A3IeoQmnOrYV4ueZGKSjhipXx8zc8nu9FGlvMA,92
|
|
8
|
-
dump_github-0.1.4.dist-info/entry_points.txt,sha256=qbBICoPzzAZRMjmgnFvndjx0SGhF8ji9MsY2F8Isrrs,50
|
|
9
|
-
dump_github-0.1.4.dist-info/top_level.txt,sha256=6oWfdkP2U1AN9zL6AUIUTxe6hYIeo_Nf8M8SWBxElUw,12
|
|
10
|
-
dump_github-0.1.4.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|