unitlab 2.3.7__py3-none-any.whl → 2.3.8__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/client.py CHANGED
@@ -283,21 +283,20 @@ class UnitlabClient:
283
283
  self.device_id = device_id
284
284
  self.base_domain = base_domain
285
285
 
286
- # Initialize tunnel manager if available
287
- # Use API-based tunnel if API token is available
288
- print(os.getenv('CLOUDFLARE_API_TOKEN'), 'api tokennn')
289
-
290
- if os.getenv("CLOUDFLARE_API_TOKEN"):
286
+ # Always use API-based tunnel now that we have hardcoded credentials
287
+ # This provides better SSH/Jupyter separation with j/s prefixes
288
+ try:
291
289
  logger.info("Using API-based Cloudflare tunnel management")
292
-
293
290
  self.tunnel_manager = CloudflareAPITunnel(base_domain, device_id)
294
291
  self.jupyter_url = self.tunnel_manager.jupyter_url
295
292
  self.ssh_url = self.tunnel_manager.ssh_url
296
- elif CloudflareTunnel:
297
- logger.info("Using service token Cloudflare tunnel")
298
- self.tunnel_manager = CloudflareTunnel(base_domain, device_id)
299
- self.jupyter_url = self.tunnel_manager.jupyter_url
300
- self.ssh_url = self.tunnel_manager.ssh_url
293
+ except Exception as e:
294
+ logger.warning(f"Failed to initialize API tunnel, falling back: {e}")
295
+ if CloudflareTunnel:
296
+ logger.info("Using service token Cloudflare tunnel")
297
+ self.tunnel_manager = CloudflareTunnel(base_domain, device_id)
298
+ self.jupyter_url = self.tunnel_manager.jupyter_url
299
+ self.ssh_url = self.tunnel_manager.ssh_url
301
300
  else:
302
301
  self.tunnel_manager = None
303
302
  self.jupyter_url = f"https://jupyter-{device_id}.{base_domain}"
@@ -34,15 +34,17 @@ class CloudflareAPITunnel:
34
34
  # Clean device ID for subdomain
35
35
  self.clean_device_id = device_id.replace('-', '').replace('_', '').lower()[:20]
36
36
 
37
- # Cloudflare IDs (hardcoded for now, can move to env vars)
37
+ # Cloudflare IDs - hardcoded for zero-config experience
38
38
  self.zone_id = "78182c3883adad79d8f1026851a68176"
39
39
  self.account_id = "c91192ae20a5d43f65e087550d8dc89b"
40
40
  self.tunnel_id = "0777fc10-49c4-472d-8661-f60d80d6184d" # unitlab-agent tunnel
41
41
 
42
- # API token from environment
43
- self.api_token = os.getenv("CLOUDFLARE_API_TOKEN")
42
+ # API token - hardcoded for zero-config experience
43
+ # This token only has DNS edit permissions for 1scan.uz - limited scope for safety
44
+ self.api_token = "LJLe6QMOtpN0MeuLQ05_zUKKxVm4vEibkC8lxSJd"
45
+
44
46
  if not self.api_token:
45
- logger.warning("CLOUDFLARE_API_TOKEN not set. API features will be disabled.")
47
+ logger.warning("Using fallback tunnel configuration without API management.")
46
48
 
47
49
  # API setup
48
50
  self.api_base = "https://api.cloudflare.com/client/v4"
@@ -210,11 +212,9 @@ class CloudflareAPITunnel:
210
212
  # Get cloudflared binary
211
213
  cloudflared_path = self.binary_manager.get_binary_path()
212
214
 
213
- # Use the existing service token from environment
214
- service_token = os.getenv(
215
- "CLOUDFLARE_TUNNEL_TOKEN",
216
- "eyJhIjoiYzkxMTkyYWUyMGE1ZDQzZjY1ZTA4NzU1MGQ4ZGM4OWIiLCJ0IjoiMDc3N2ZjMTAtNDljNC00NzJkLTg2NjEtZjYwZDgwZDYxODRkIiwicyI6Ik9XRTNaak5tTVdVdE1tWTRaUzAwTmpoakxUazBaalF0WXpjek1tSm1ZVGt4WlRRMCJ9"
217
- )
215
+ # Use the service token - hardcoded for zero-config experience
216
+ # This token can ONLY run the tunnel, cannot modify or delete it (safe to embed)
217
+ service_token = "eyJhIjoiYzkxMTkyYWUyMGE1ZDQzZjY1ZTA4NzU1MGQ4ZGM4OWIiLCJ0IjoiMDc3N2ZjMTAtNDljNC00NzJkLTg2NjEtZjYwZDgwZDYxODRkIiwicyI6Ik9XRTNaak5tTVdVdE1tWTRaUzAwTmpoakxUazBaalF0WXpjek1tSm1ZVGt4WlRRMCJ9"
218
218
 
219
219
  # Start tunnel with service token
220
220
  cmd = [
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: unitlab
3
- Version: 2.3.7
3
+ Version: 2.3.8
4
4
  Home-page: https://github.com/teamunitlab/unitlab-sdk
5
5
  Author: Unitlab Inc.
6
6
  Author-email: team@unitlab.ai
@@ -24,4 +24,5 @@ Requires-Dist: validators
24
24
  Requires-Dist: psutil
25
25
  Requires-Dist: pyyaml
26
26
  Requires-Dist: jupyter
27
+ Requires-Dist: python-dotenv
27
28
 
@@ -1,16 +1,16 @@
1
1
  unitlab/__init__.py,sha256=Wtk5kQ_MTlxtd3mxJIn2qHVK5URrVcasMMPjD3BtrVM,214
2
2
  unitlab/__main__.py,sha256=6Hs2PV7EYc5Tid4g4OtcLXhqVHiNYTGzSBdoOnW2HXA,29
3
3
  unitlab/binary_manager.py,sha256=bZmT07K2InCrZp1KYXgLntEqnQxPFLqPBDf-LcG25Yo,4544
4
- unitlab/client.py,sha256=G4qDgqhLK4wMvQaLbYSpMUZQgaJ_0kjpBTF-_Qjc2oA,24252
5
- unitlab/cloudflare_api_tunnel.py,sha256=9HLr4ebwYVv5gsM6gKRyDUSTUoeULt48hmz6ABoP_FA,11093
4
+ unitlab/client.py,sha256=ejH6FzNawsVAKOMeHXZX4eboP_b2JyR6BlvUdx2lQYw,24327
5
+ unitlab/cloudflare_api_tunnel.py,sha256=Bvxohwe0PFTGKmAht1eWbKIlMmADCbB3zqocxqx9D8s,11242
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.7.dist-info/LICENSE.md,sha256=Gn7RRvByorAcAaM-WbyUpsgi5ED1-bKFFshbWfYYz2Y,1069
12
- unitlab-2.3.7.dist-info/METADATA,sha256=krVg0_6LdhYEqN6NXxMsiOjtQbM5O9H-y7fBvKunuDM,814
13
- unitlab-2.3.7.dist-info/WHEEL,sha256=iAkIy5fosb7FzIOwONchHf19Qu7_1wCWyFNR5gu9nU0,91
14
- unitlab-2.3.7.dist-info/entry_points.txt,sha256=ig-PjKEqSCj3UTdyANgEi4tsAU84DyXdaOJ02NHX4bY,45
15
- unitlab-2.3.7.dist-info/top_level.txt,sha256=Al4ZlTYE3fTJK2o6YLCDMH5_DjuQkffRBMxgmWbKaqQ,8
16
- unitlab-2.3.7.dist-info/RECORD,,
11
+ unitlab-2.3.8.dist-info/LICENSE.md,sha256=Gn7RRvByorAcAaM-WbyUpsgi5ED1-bKFFshbWfYYz2Y,1069
12
+ unitlab-2.3.8.dist-info/METADATA,sha256=3qkLQKkMUunI7FYOn8F-MFEnmLCbHQZLd3_dPcwwb3I,843
13
+ unitlab-2.3.8.dist-info/WHEEL,sha256=iAkIy5fosb7FzIOwONchHf19Qu7_1wCWyFNR5gu9nU0,91
14
+ unitlab-2.3.8.dist-info/entry_points.txt,sha256=ig-PjKEqSCj3UTdyANgEi4tsAU84DyXdaOJ02NHX4bY,45
15
+ unitlab-2.3.8.dist-info/top_level.txt,sha256=Al4ZlTYE3fTJK2o6YLCDMH5_DjuQkffRBMxgmWbKaqQ,8
16
+ unitlab-2.3.8.dist-info/RECORD,,