unitlab 2.3.10__py3-none-any.whl → 2.3.11__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.
unitlab/binary_manager.py CHANGED
@@ -89,6 +89,12 @@ class CloudflaredBinaryManager:
89
89
 
90
90
  def _download_binary(self, info, target_path):
91
91
  """Download and verify binary"""
92
+
93
+ # Create SSL context to handle certificate issues
94
+ import ssl
95
+ ssl_context = ssl.create_default_context()
96
+ ssl_context.check_hostname = False
97
+ ssl_context.verify_mode = ssl.CERT_NONE
92
98
 
93
99
  # Download with progress bar
94
100
  def download_progress(block_num, block_size, total_size):
@@ -102,12 +108,23 @@ class CloudflaredBinaryManager:
102
108
  temp_file = target_path.with_suffix('.tmp')
103
109
 
104
110
  try:
105
- # Download file
106
- urllib.request.urlretrieve(
107
- info['url'],
108
- temp_file,
109
- reporthook=download_progress
110
- )
111
+ # Download file with SSL context
112
+ req = urllib.request.Request(info['url'], headers={'User-Agent': 'Mozilla/5.0'})
113
+ with urllib.request.urlopen(req, context=ssl_context) as response:
114
+ total_size = int(response.headers.get('Content-Length', 0))
115
+
116
+ with open(temp_file, 'wb') as f:
117
+ downloaded = 0
118
+ block_size = 8192
119
+ while True:
120
+ chunk = response.read(block_size)
121
+ if not chunk:
122
+ break
123
+ f.write(chunk)
124
+ downloaded += len(chunk)
125
+ if total_size > 0:
126
+ percent = min(downloaded * 100 / total_size, 100)
127
+ print(f"Downloading: {percent:.0f}%", end='\r')
111
128
  print("\n✓ Download complete")
112
129
 
113
130
  # Handle compressed files (macOS .tgz)
@@ -297,6 +297,12 @@ class CloudflareAPITunnel:
297
297
  # Direct download fallback - simplified version
298
298
  import platform
299
299
  import urllib.request
300
+ import ssl
301
+
302
+ # Create SSL context that handles certificate issues
303
+ ssl_context = ssl.create_default_context()
304
+ ssl_context.check_hostname = False
305
+ ssl_context.verify_mode = ssl.CERT_NONE
300
306
 
301
307
  cache_dir = Path.home() / '.unitlab' / 'bin'
302
308
  cache_dir.mkdir(parents=True, exist_ok=True)
@@ -331,8 +337,25 @@ class CloudflareAPITunnel:
331
337
  raise RuntimeError(f"Unsupported platform: {system}")
332
338
 
333
339
  try:
334
- # Download the file
335
- urllib.request.urlretrieve(url, cloudflared_path)
340
+ # Download the file with SSL context
341
+ req = urllib.request.Request(url, headers={'User-Agent': 'Mozilla/5.0'})
342
+
343
+ # Special handling for macOS .tgz files
344
+ if system == 'darwin':
345
+ import tarfile
346
+ import io
347
+
348
+ with urllib.request.urlopen(req, context=ssl_context) as response:
349
+ data = response.read()
350
+
351
+ # Extract from tar.gz
352
+ with tarfile.open(fileobj=io.BytesIO(data), mode='r:gz') as tar:
353
+ tar.extract('cloudflared', cache_dir)
354
+ else:
355
+ # Direct binary download for Linux/Windows
356
+ with urllib.request.urlopen(req, context=ssl_context) as response:
357
+ with open(cloudflared_path, 'wb') as out_file:
358
+ out_file.write(response.read())
336
359
 
337
360
  # Make executable on Unix
338
361
  if system != 'windows':
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: unitlab
3
- Version: 2.3.10
3
+ Version: 2.3.11
4
4
  Home-page: https://github.com/teamunitlab/unitlab-sdk
5
5
  Author: Unitlab Inc.
6
6
  Author-email: team@unitlab.ai
@@ -1,16 +1,16 @@
1
1
  unitlab/__init__.py,sha256=Wtk5kQ_MTlxtd3mxJIn2qHVK5URrVcasMMPjD3BtrVM,214
2
2
  unitlab/__main__.py,sha256=6Hs2PV7EYc5Tid4g4OtcLXhqVHiNYTGzSBdoOnW2HXA,29
3
- unitlab/binary_manager.py,sha256=bZmT07K2InCrZp1KYXgLntEqnQxPFLqPBDf-LcG25Yo,4544
3
+ unitlab/binary_manager.py,sha256=Q1v2Odm0hk_3g7jfDUJQfkjEbUbSjtuyo2JDUyWjDrk,5468
4
4
  unitlab/client.py,sha256=nA2jeRNWu_Devq841rTt8tSFwHr9y9oJ2GZnPL6GTog,24343
5
- unitlab/cloudflare_api_tunnel.py,sha256=ccFAVXXVFLTmIzgVFgCRFyReHrjipGLt00k-0nnCmHM,14481
5
+ unitlab/cloudflare_api_tunnel.py,sha256=d95e4c4SvjpCtnQz_aGTvP-ma9fkxsbvV-oIq3aWxIk,15533
6
6
  unitlab/exceptions.py,sha256=68Tr6LreEzjQ3Vns8HAaWdtewtkNUJOvPazbf6NSnXU,950
7
7
  unitlab/main.py,sha256=h1WG6up6STt-2fJZAkqnxenwJ7kmkqnkfq5Zs4xLSeI,5257
8
8
  unitlab/tunnel_config.py,sha256=7CiAqasfg26YQfJYXapCBQPSoqw4jIx6yR64saybLLo,8312
9
9
  unitlab/tunnel_service_token.py,sha256=ji96a4s4W2cFJrHZle0zBD85Ac_T862-gCKzBUomrxM,3125
10
10
  unitlab/utils.py,sha256=83ekAxxfXecFTg76Z62BGDybC_skKJHYoLyawCD9wGM,1920
11
- unitlab-2.3.10.dist-info/LICENSE.md,sha256=Gn7RRvByorAcAaM-WbyUpsgi5ED1-bKFFshbWfYYz2Y,1069
12
- unitlab-2.3.10.dist-info/METADATA,sha256=EvIeQay7u1oL5jUyaD3p2ivNXC_BsRnwmvTrHO4xqIk,844
13
- unitlab-2.3.10.dist-info/WHEEL,sha256=iAkIy5fosb7FzIOwONchHf19Qu7_1wCWyFNR5gu9nU0,91
14
- unitlab-2.3.10.dist-info/entry_points.txt,sha256=ig-PjKEqSCj3UTdyANgEi4tsAU84DyXdaOJ02NHX4bY,45
15
- unitlab-2.3.10.dist-info/top_level.txt,sha256=Al4ZlTYE3fTJK2o6YLCDMH5_DjuQkffRBMxgmWbKaqQ,8
16
- unitlab-2.3.10.dist-info/RECORD,,
11
+ unitlab-2.3.11.dist-info/LICENSE.md,sha256=Gn7RRvByorAcAaM-WbyUpsgi5ED1-bKFFshbWfYYz2Y,1069
12
+ unitlab-2.3.11.dist-info/METADATA,sha256=RYenBK_Eh_TVYapfjlgswInVFk6dBI9K-KrTznSkVgw,844
13
+ unitlab-2.3.11.dist-info/WHEEL,sha256=iAkIy5fosb7FzIOwONchHf19Qu7_1wCWyFNR5gu9nU0,91
14
+ unitlab-2.3.11.dist-info/entry_points.txt,sha256=ig-PjKEqSCj3UTdyANgEi4tsAU84DyXdaOJ02NHX4bY,45
15
+ unitlab-2.3.11.dist-info/top_level.txt,sha256=Al4ZlTYE3fTJK2o6YLCDMH5_DjuQkffRBMxgmWbKaqQ,8
16
+ unitlab-2.3.11.dist-info/RECORD,,