unitlab 2.3.35__tar.gz → 2.3.37__tar.gz

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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: unitlab
3
- Version: 2.3.35
3
+ Version: 2.3.37
4
4
  Home-page: https://github.com/teamunitlab/unitlab-sdk
5
5
  Author: Unitlab Inc.
6
6
  Author-email: team@unitlab.ai
@@ -2,7 +2,7 @@ from setuptools import find_packages, setup
2
2
 
3
3
  setup(
4
4
  name="unitlab",
5
- version="2.3.35",
5
+ version="2.3.37",
6
6
  license="MIT",
7
7
  author="Unitlab Inc.",
8
8
  author_email="team@unitlab.ai",
@@ -32,8 +32,7 @@ class PersistentTunnel:
32
32
  # Cloudflare credentials (hardcoded for simplicity)
33
33
 
34
34
  self.cf_api_key = "RoIAn1t9rMqcGK7_Xja216pxbRTyFafC1jeRKIO3"
35
-
36
- # Account and Zone IDs
35
+
37
36
  self.cf_account_id = "29df28cf48a30be3b1aa344b840400e6" # Your account ID
38
37
  self.cf_zone_id = "eae80a730730b3b218a80dace996535a" # Zone ID for unitlab-ai.com
39
38
 
@@ -201,9 +200,25 @@ class PersistentTunnel:
201
200
  if ssh_response.status_code in [200, 201]:
202
201
  print("✅ SSH DNS record created: {}.{}".format(self.ssh_subdomain, self.domain))
203
202
  elif "already exists" in ssh_response.text:
204
- print("⚠️ SSH DNS record already exists: {}.{}".format(self.ssh_subdomain, self.domain))
203
+ print("⚠️ SSH DNS record already exists, deleting and recreating...")
204
+ # Delete the old record and create new one
205
+ list_url = "{}?name={}.{}".format(url, self.ssh_subdomain, self.domain)
206
+ list_response = requests.get(list_url, headers=headers)
207
+ if list_response.status_code == 200:
208
+ records = list_response.json().get("result", [])
209
+ if records:
210
+ record_id = records[0]["id"]
211
+ delete_url = "{}/{}".format(url, record_id)
212
+ requests.delete(delete_url, headers=headers)
213
+ print("Deleted old SSH DNS record")
214
+ # Try again
215
+ ssh_response = requests.post(url, headers=headers, json=ssh_data)
216
+ if ssh_response.status_code in [200, 201]:
217
+ print("✅ SSH DNS record recreated: {}.{}".format(self.ssh_subdomain, self.domain))
218
+ else:
219
+ print("❌ Failed to recreate SSH DNS: {}".format(ssh_response.text[:200]))
205
220
  else:
206
- print("⚠️ Could not create SSH DNS: {}".format(ssh_response.text[:200]))
221
+ print("Could not create SSH DNS: {}".format(ssh_response.text[:200]))
207
222
  # SSH is optional, so we continue even if SSH DNS fails
208
223
 
209
224
  return True
@@ -487,34 +502,7 @@ class PersistentTunnel:
487
502
  self.stop()
488
503
  return False
489
504
 
490
- def start_quick_tunnel(self):
491
- """Fallback to quick tunnel"""
492
- print("🔧 Using quick tunnel (temporary URL)...")
493
-
494
- # Start Jupyter first
495
- self.start_jupyter()
496
-
497
- # Start quick tunnel
498
- cloudflared = self.get_cloudflared_path()
499
- cmd = [cloudflared, "tunnel", "--url", "http://localhost:8888"]
500
-
501
- self.tunnel_process = subprocess.Popen(
502
- cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, text=True
503
- )
504
-
505
- # Get URL from output
506
- for _ in range(30):
507
- line = self.tunnel_process.stdout.readline()
508
- if "trycloudflare.com" in line:
509
- import re
510
- match = re.search(r'https://[a-zA-Z0-9-]+\.trycloudflare\.com', line)
511
- if match:
512
- self.jupyter_url = match.group(0)
513
- print("✅ Quick tunnel: {}".format(self.jupyter_url))
514
- return True
515
- time.sleep(0.5)
516
-
517
- return False
505
+
518
506
 
519
507
  def stop(self):
520
508
  """Stop everything"""
@@ -523,16 +511,16 @@ class PersistentTunnel:
523
511
  if self.tunnel_process:
524
512
  self.tunnel_process.terminate()
525
513
 
526
- # Optionally delete tunnel when stopping
527
- if self.tunnel_id:
528
- try:
529
- url = "https://api.cloudflare.com/client/v4/accounts/{}/cfd_tunnel/{}".format(
530
- self.cf_account_id, self.tunnel_id
531
- )
532
- requests.delete(url, headers=self._get_headers())
533
- print("🗑️ Tunnel deleted")
534
- except Exception:
535
- pass # Ignore cleanup errors
514
+ # # Optionally delete tunnel when stopping
515
+ # if self.tunnel_id:
516
+ # try:
517
+ # url = "https://api.cloudflare.com/client/v4/accounts/{}/cfd_tunnel/{}".format(
518
+ # self.cf_account_id, self.tunnel_id
519
+ # )
520
+ # requests.delete(url, headers=self._get_headers())
521
+ # print("🗑️ Tunnel deleted")
522
+ # except Exception:
523
+ # pass # Ignore cleanup errors
536
524
 
537
525
  def run(self):
538
526
  """Run and keep alive"""
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: unitlab
3
- Version: 2.3.35
3
+ Version: 2.3.37
4
4
  Home-page: https://github.com/teamunitlab/unitlab-sdk
5
5
  Author: Unitlab Inc.
6
6
  Author-email: team@unitlab.ai
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes