github-backup 0.51.0__py3-none-any.whl → 0.51.2__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.
- github_backup/__init__.py +1 -1
- github_backup/github_backup.py +28 -26
- {github_backup-0.51.0.dist-info → github_backup-0.51.2.dist-info}/METADATA +1 -1
- github_backup-0.51.2.dist-info/RECORD +9 -0
- github_backup-0.51.0.dist-info/RECORD +0 -9
- {github_backup-0.51.0.data → github_backup-0.51.2.data}/scripts/github-backup +0 -0
- {github_backup-0.51.0.dist-info → github_backup-0.51.2.dist-info}/WHEEL +0 -0
- {github_backup-0.51.0.dist-info → github_backup-0.51.2.dist-info}/licenses/LICENSE.txt +0 -0
- {github_backup-0.51.0.dist-info → github_backup-0.51.2.dist-info}/top_level.txt +0 -0
- {github_backup-0.51.0.dist-info → github_backup-0.51.2.dist-info}/zip-safe +0 -0
github_backup/__init__.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
__version__ = "0.51.
|
|
1
|
+
__version__ = "0.51.2"
|
github_backup/github_backup.py
CHANGED
|
@@ -37,22 +37,33 @@ FNULL = open(os.devnull, "w")
|
|
|
37
37
|
FILE_URI_PREFIX = "file://"
|
|
38
38
|
logger = logging.getLogger(__name__)
|
|
39
39
|
|
|
40
|
+
# Setup SSL context with fallback chain
|
|
40
41
|
https_ctx = ssl.create_default_context()
|
|
41
|
-
if
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
)
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
42
|
+
if https_ctx.get_ca_certs():
|
|
43
|
+
# Layer 1: Certificates pre-loaded from system (file-based)
|
|
44
|
+
pass
|
|
45
|
+
else:
|
|
46
|
+
paths = ssl.get_default_verify_paths()
|
|
47
|
+
if (paths.cafile and os.path.exists(paths.cafile)) or (
|
|
48
|
+
paths.capath and os.path.exists(paths.capath)
|
|
49
|
+
):
|
|
50
|
+
# Layer 2: Cert paths exist, will be lazy-loaded on first use (directory-based)
|
|
51
|
+
pass
|
|
52
|
+
else:
|
|
53
|
+
# Layer 3: Try certifi package as optional fallback
|
|
54
|
+
try:
|
|
55
|
+
import certifi
|
|
56
|
+
|
|
57
|
+
https_ctx = ssl.create_default_context(cafile=certifi.where())
|
|
58
|
+
except ImportError:
|
|
59
|
+
# All layers failed - no certificates available anywhere
|
|
60
|
+
sys.exit(
|
|
61
|
+
"\nERROR: No CA certificates found. Cannot connect to GitHub over SSL.\n\n"
|
|
62
|
+
"Solutions you can explore:\n"
|
|
63
|
+
" 1. pip install certifi\n"
|
|
64
|
+
" 2. Alpine: apk add ca-certificates\n"
|
|
65
|
+
" 3. Debian/Ubuntu: apt-get install ca-certificates\n\n"
|
|
66
|
+
)
|
|
56
67
|
|
|
57
68
|
|
|
58
69
|
def logging_subprocess(
|
|
@@ -919,12 +930,6 @@ def download_attachment_file(url, path, auth, as_app=False, fine=False):
|
|
|
919
930
|
"error": None,
|
|
920
931
|
}
|
|
921
932
|
|
|
922
|
-
if os.path.exists(path):
|
|
923
|
-
metadata["success"] = True
|
|
924
|
-
metadata["http_status"] = 200 # Assume success if already exists
|
|
925
|
-
metadata["size_bytes"] = os.path.getsize(path)
|
|
926
|
-
return metadata
|
|
927
|
-
|
|
928
933
|
# Create simple request (no API query params)
|
|
929
934
|
request = Request(url)
|
|
930
935
|
request.add_header("Accept", "application/octet-stream")
|
|
@@ -1337,10 +1342,10 @@ def download_attachments(
|
|
|
1337
1342
|
attachments_dir = os.path.join(item_cwd, "attachments", str(number))
|
|
1338
1343
|
manifest_path = os.path.join(attachments_dir, "manifest.json")
|
|
1339
1344
|
|
|
1340
|
-
# Load existing manifest
|
|
1345
|
+
# Load existing manifest to prevent duplicate downloads
|
|
1341
1346
|
existing_urls = set()
|
|
1342
1347
|
existing_metadata = []
|
|
1343
|
-
if
|
|
1348
|
+
if os.path.exists(manifest_path):
|
|
1344
1349
|
try:
|
|
1345
1350
|
with open(manifest_path, "r") as f:
|
|
1346
1351
|
existing_manifest = json.load(f)
|
|
@@ -1395,9 +1400,6 @@ def download_attachments(
|
|
|
1395
1400
|
filename = get_attachment_filename(url)
|
|
1396
1401
|
filepath = os.path.join(attachments_dir, filename)
|
|
1397
1402
|
|
|
1398
|
-
# Check for collision BEFORE downloading
|
|
1399
|
-
filepath = resolve_filename_collision(filepath)
|
|
1400
|
-
|
|
1401
1403
|
# Download and get metadata
|
|
1402
1404
|
metadata = download_attachment_file(
|
|
1403
1405
|
url,
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
github_backup/__init__.py,sha256=2AuLzuHMBBPVOM-m0Woty11pTO9ExwPKWRWtj1LvS-g,23
|
|
2
|
+
github_backup/github_backup.py,sha256=ousskr9hBtfKgAh1x78vnSefQhPGqa9K2fLxWLUKdyY,75428
|
|
3
|
+
github_backup-0.51.2.data/scripts/github-backup,sha256=I79TNA67phytRmI9nm_LlD9h2zauXFOsOn9tYyAy9pU,1546
|
|
4
|
+
github_backup-0.51.2.dist-info/licenses/LICENSE.txt,sha256=ML-pLyn1qtAKo_DHMcQ8-p7k3f8cp-IR-mf5B49R2rk,1085
|
|
5
|
+
github_backup-0.51.2.dist-info/METADATA,sha256=zoLPP4sNYwAsnFUXTZR1K1NB5J-i2xQidc9DZ3hbkfk,21544
|
|
6
|
+
github_backup-0.51.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
7
|
+
github_backup-0.51.2.dist-info/top_level.txt,sha256=Za6fKRAlxZ0b3ZBH_osPqklLe14LetdNAkvAQANT2AA,14
|
|
8
|
+
github_backup-0.51.2.dist-info/zip-safe,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
|
|
9
|
+
github_backup-0.51.2.dist-info/RECORD,,
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
github_backup/__init__.py,sha256=5j_riw1v3MMRXNOOd6h7WlISOYlrHrS61_8RReiM4yA,23
|
|
2
|
-
github_backup/github_backup.py,sha256=RuqAJo0U7q3BdSp--vxvhZJWPzXrhaj1aRjwvBqRCRc,75127
|
|
3
|
-
github_backup-0.51.0.data/scripts/github-backup,sha256=I79TNA67phytRmI9nm_LlD9h2zauXFOsOn9tYyAy9pU,1546
|
|
4
|
-
github_backup-0.51.0.dist-info/licenses/LICENSE.txt,sha256=ML-pLyn1qtAKo_DHMcQ8-p7k3f8cp-IR-mf5B49R2rk,1085
|
|
5
|
-
github_backup-0.51.0.dist-info/METADATA,sha256=hs33ckMCaiNoIPcTp3C7dX07tBGR5YdSZ79NNVwiWZg,21544
|
|
6
|
-
github_backup-0.51.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
7
|
-
github_backup-0.51.0.dist-info/top_level.txt,sha256=Za6fKRAlxZ0b3ZBH_osPqklLe14LetdNAkvAQANT2AA,14
|
|
8
|
-
github_backup-0.51.0.dist-info/zip-safe,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
|
|
9
|
-
github_backup-0.51.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|