sideload 1.2.0__py3-none-any.whl → 1.3.0__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.

Potentially problematic release.


This version of sideload might be problematic. Click here for more details.

sideload/cli.py CHANGED
@@ -33,9 +33,19 @@ console = Console()
33
33
 
34
34
 
35
35
  class SideloadClient:
36
- def __init__(self, jsonbin_token: str, collection_id: str):
36
+ def __init__(
37
+ self,
38
+ jsonbin_token: str,
39
+ collection_id: str,
40
+ verify_ssl: bool = True,
41
+ key_type: str = "master"
42
+ ):
37
43
  self.collection_id = collection_id
38
- self.connector = JSONBinConnector(jsonbin_token)
44
+ self.connector = JSONBinConnector(
45
+ jsonbin_token,
46
+ verify_ssl=verify_ssl,
47
+ key_type=key_type
48
+ )
39
49
  self.manager = SideloadBinManager(self.connector)
40
50
 
41
51
  def __enter__(self):
@@ -380,6 +390,17 @@ Examples:
380
390
  type=Path,
381
391
  help="Working directory for extraction (for debugging, defaults to temp directory)",
382
392
  )
393
+ download_parser.add_argument(
394
+ "--no-verify-ssl",
395
+ action="store_true",
396
+ help="Disable SSL certificate verification for JSONBin API",
397
+ )
398
+ download_parser.add_argument(
399
+ "--jsonbin-key-type",
400
+ choices=["master", "access"],
401
+ default=None,
402
+ help="JSONBin key type to use (default: from JSONBIN_KEY_TYPE env or 'master')",
403
+ )
383
404
 
384
405
  args = parser.parse_args()
385
406
 
@@ -394,6 +415,19 @@ Examples:
394
415
  jsonbin_token = args.token or os.environ.get("JSONBIN_TOKEN")
395
416
  collection_id = args.collection or os.environ.get("SIDELOAD_COLLECTION_ID")
396
417
 
418
+ # Get SSL verification setting (CLI flag overrides env var)
419
+ verify_ssl = not args.no_verify_ssl
420
+ if args.no_verify_ssl:
421
+ # If CLI flag is set, disable SSL verification
422
+ verify_ssl = False
423
+ else:
424
+ # Otherwise check environment variable (default to True)
425
+ env_verify = os.environ.get("JSONBIN_VERIFY_SSL", "true").lower()
426
+ verify_ssl = env_verify in ("true", "1", "yes")
427
+
428
+ # Get key type (CLI arg > env var > default)
429
+ key_type = args.jsonbin_key_type or os.environ.get("JSONBIN_KEY_TYPE", "master").lower()
430
+
397
431
  if not jsonbin_token:
398
432
  console.print(
399
433
  "❌ JSONBin token required. Set JSONBIN_TOKEN environment variable or use --token",
@@ -418,10 +452,12 @@ Examples:
418
452
  console.print(f" [dim]Output:[/dim] {args.output}")
419
453
  console.print(f" [dim]Work Directory:[/dim] {args.work_dir or 'temp (auto-cleanup)'}")
420
454
  console.print(f" [dim]Collection ID:[/dim] {collection_id}")
455
+ console.print(f" [dim]SSL Verification:[/dim] {verify_ssl}")
456
+ console.print(f" [dim]JSONBin Key Type:[/dim] {key_type}")
421
457
  console.print()
422
458
 
423
459
  try:
424
- with SideloadClient(jsonbin_token, collection_id) as client:
460
+ with SideloadClient(jsonbin_token, collection_id, verify_ssl, key_type) as client:
425
461
  # Create the request
426
462
  console.print(
427
463
  f"🌐 Requesting download for: [bold blue]{args.url}[/bold blue]"
@@ -2,13 +2,26 @@ import os
2
2
  import httpx
3
3
 
4
4
  JSONBIN_TOKEN = os.environ["JSONBIN_TOKEN"]
5
+ JSONBIN_VERIFY_SSL = os.environ.get("JSONBIN_VERIFY_SSL", "true").lower() in ("true", "1", "yes")
6
+ JSONBIN_KEY_TYPE = os.environ.get("JSONBIN_KEY_TYPE", "master").lower() # "master" or "access"
5
7
 
6
8
 
7
9
  class JSONBinConnector:
8
- def __init__(self):
10
+ def __init__(self, verify_ssl: bool = None, key_type: str = None):
11
+ # Use provided values or fall back to environment variables
12
+ verify = JSONBIN_VERIFY_SSL if verify_ssl is None else verify_ssl
13
+ key_type = key_type or JSONBIN_KEY_TYPE
14
+
15
+ # Determine the key header to use
16
+ if key_type == "access":
17
+ key_header = "X-Access-Key"
18
+ else:
19
+ key_header = "X-Master-Key"
20
+
9
21
  self.client = httpx.Client(
10
22
  base_url="https://api.jsonbin.io/v3",
11
- headers={"X-Master-Key": JSONBIN_TOKEN, "Content-Type": "application/json"},
23
+ headers={key_header: JSONBIN_TOKEN, "Content-Type": "application/json"},
24
+ verify=verify,
12
25
  )
13
26
 
14
27
  def get_collections(self) -> list:
sideload/jsonbin_old.py CHANGED
@@ -11,19 +11,35 @@ from typing import Dict, List, Optional, Any
11
11
  class JSONBinConnector:
12
12
  """A connector for JSONBin.io API with httpx"""
13
13
 
14
- def __init__(self, api_token: str, base_url: str = "https://api.jsonbin.io/v3"):
14
+ def __init__(
15
+ self,
16
+ api_token: str,
17
+ base_url: str = "https://api.jsonbin.io/v3",
18
+ verify_ssl: bool = True,
19
+ key_type: str = "master"
20
+ ):
15
21
  """
16
22
  Initialize the JSONBin connector
17
23
 
18
24
  Args:
19
25
  api_token: JSONBin API token
20
26
  base_url: JSONBin API base URL
27
+ verify_ssl: Whether to verify SSL certificates (default: True)
28
+ key_type: Type of key to use - "master" or "access" (default: "master")
21
29
  """
22
30
  self.api_token = api_token
23
31
  self.base_url = base_url
32
+
33
+ # Determine the key header to use
34
+ if key_type == "access":
35
+ key_header = "X-Access-Key"
36
+ else:
37
+ key_header = "X-Master-Key"
38
+
24
39
  self.client = httpx.Client(
25
40
  base_url=base_url,
26
- headers={"X-Master-Key": api_token, "Content-Type": "application/json"},
41
+ headers={key_header: api_token, "Content-Type": "application/json"},
42
+ verify=verify_ssl,
27
43
  )
28
44
 
29
45
  def __enter__(self):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: sideload
3
- Version: 1.2.0
3
+ Version: 1.3.0
4
4
  Summary: Download large files via PyPI packages
5
5
  Author: Sygmei
6
6
  Author-email: Sygmei <3835355+Sygmei@users.noreply.github.com>
@@ -0,0 +1,11 @@
1
+ sideload/__init__.py,sha256=Y3rHLtR7n0sjLXrn-BEcrbIHx-9uE1tPZkooavo7xcA,222
2
+ sideload/cli.py,sha256=8CcoZf9_7XHzlFA9XBBZn19RRNAbrFfRshVIWWSaFhQ,20186
3
+ sideload/jsonbin.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
+ sideload/jsonbin_connector.py,sha256=IS7YdSBZeZMoTwOyA1I0T7aw36-KERYNnD324dRRI5A,2305
5
+ sideload/jsonbin_old.py,sha256=Rs657F3dTtdoxVYolByuyINABCIQx_VLxwxgdne1mws,8865
6
+ sideload/main.py,sha256=EiZguc4-ug8RM6vXkZuXW_ps8jFWoAfeKBBNy7FX-F0,7600
7
+ sideload/scripts/cleanup_pypi.py,sha256=CouuOhnbpSbrFc1KhlOeZAuajVVpGF9d4qwFpIKkEvY,5906
8
+ sideload-1.3.0.dist-info/WHEEL,sha256=-neZj6nU9KAMg2CnCY6T3w8J53nx1kFGw_9HfoSzM60,79
9
+ sideload-1.3.0.dist-info/entry_points.txt,sha256=7ULrIjaVhrxMhuddTeoPjeIrqmIvVc9cSU3lZU2_YqE,44
10
+ sideload-1.3.0.dist-info/METADATA,sha256=r0lod7DO3pFy-v0M9HQQFHKTiPih1jCApRnwZWVRZ8o,4281
11
+ sideload-1.3.0.dist-info/RECORD,,
@@ -1,11 +0,0 @@
1
- sideload/__init__.py,sha256=Y3rHLtR7n0sjLXrn-BEcrbIHx-9uE1tPZkooavo7xcA,222
2
- sideload/cli.py,sha256=JCedG4Xqz3AQ-24eerMW8ZdBpTx_sOZI1nfXDzOU9dE,18843
3
- sideload/jsonbin.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
- sideload/jsonbin_connector.py,sha256=HtR1Pwnpm5jfYcmnvcug9HaKxFpsyJBXYYlLuzWPiTE,1680
5
- sideload/jsonbin_old.py,sha256=ve21WsV7Ay60moFfrR4lSM_JRZNqo4z5v69cNw0Iqo0,8411
6
- sideload/main.py,sha256=EiZguc4-ug8RM6vXkZuXW_ps8jFWoAfeKBBNy7FX-F0,7600
7
- sideload/scripts/cleanup_pypi.py,sha256=CouuOhnbpSbrFc1KhlOeZAuajVVpGF9d4qwFpIKkEvY,5906
8
- sideload-1.2.0.dist-info/WHEEL,sha256=-neZj6nU9KAMg2CnCY6T3w8J53nx1kFGw_9HfoSzM60,79
9
- sideload-1.2.0.dist-info/entry_points.txt,sha256=7ULrIjaVhrxMhuddTeoPjeIrqmIvVc9cSU3lZU2_YqE,44
10
- sideload-1.2.0.dist-info/METADATA,sha256=OVl1VRCVXj0m3JeHtdEQ0bjX6LyEVf8R4_tKTATPBIw,4281
11
- sideload-1.2.0.dist-info/RECORD,,