orgo 0.0.26__tar.gz → 0.0.28__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.
- {orgo-0.0.26 → orgo-0.0.28}/PKG-INFO +1 -1
- {orgo-0.0.26 → orgo-0.0.28}/pyproject.toml +1 -1
- {orgo-0.0.26 → orgo-0.0.28}/src/orgo/api/client.py +18 -30
- {orgo-0.0.26 → orgo-0.0.28}/src/orgo/computer.py +2 -3
- {orgo-0.0.26 → orgo-0.0.28}/src/orgo/project.py +2 -2
- {orgo-0.0.26 → orgo-0.0.28}/src/orgo.egg-info/PKG-INFO +1 -1
- {orgo-0.0.26 → orgo-0.0.28}/README.md +0 -0
- {orgo-0.0.26 → orgo-0.0.28}/setup.cfg +0 -0
- {orgo-0.0.26 → orgo-0.0.28}/src/orgo/__init__.py +0 -0
- {orgo-0.0.26 → orgo-0.0.28}/src/orgo/api/__init__.py +0 -0
- {orgo-0.0.26 → orgo-0.0.28}/src/orgo/prompt.py +0 -0
- {orgo-0.0.26 → orgo-0.0.28}/src/orgo/utils/__init__.py +0 -0
- {orgo-0.0.26 → orgo-0.0.28}/src/orgo/utils/auth.py +0 -0
- {orgo-0.0.26 → orgo-0.0.28}/src/orgo.egg-info/SOURCES.txt +0 -0
- {orgo-0.0.26 → orgo-0.0.28}/src/orgo.egg-info/dependency_links.txt +0 -0
- {orgo-0.0.26 → orgo-0.0.28}/src/orgo.egg-info/requires.txt +0 -0
- {orgo-0.0.26 → orgo-0.0.28}/src/orgo.egg-info/top_level.txt +0 -0
|
@@ -2,9 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
import requests
|
|
4
4
|
from typing import Dict, Any, Optional, List
|
|
5
|
+
import logging
|
|
5
6
|
|
|
6
7
|
from orgo.utils.auth import get_api_key
|
|
7
8
|
|
|
9
|
+
logger = logging.getLogger(__name__)
|
|
10
|
+
|
|
8
11
|
class ApiClient:
|
|
9
12
|
def __init__(self, api_key: Optional[str] = None, base_url: Optional[str] = None):
|
|
10
13
|
self.api_key = get_api_key(api_key)
|
|
@@ -28,16 +31,20 @@ class ApiClient:
|
|
|
28
31
|
response.raise_for_status()
|
|
29
32
|
return response.json()
|
|
30
33
|
except requests.exceptions.RequestException as e:
|
|
34
|
+
# Log the full error for debugging
|
|
35
|
+
logger.debug(f"API request failed: {method} {url}", exc_info=True)
|
|
36
|
+
|
|
31
37
|
if hasattr(e, 'response') and e.response is not None:
|
|
32
|
-
error_message = f"API error: {e.response.status_code}"
|
|
33
38
|
try:
|
|
34
39
|
error_data = e.response.json()
|
|
35
40
|
if 'error' in error_data:
|
|
36
|
-
|
|
41
|
+
raise Exception(error_data['error']) from None
|
|
37
42
|
except ValueError:
|
|
38
43
|
pass
|
|
39
|
-
raise Exception(
|
|
40
|
-
|
|
44
|
+
raise Exception(f"Request failed with status {e.response.status_code}") from None
|
|
45
|
+
|
|
46
|
+
# Generic error message without exposing internal details
|
|
47
|
+
raise Exception("Failed to connect to Orgo service. Please check your connection and try again.") from None
|
|
41
48
|
|
|
42
49
|
# Project methods
|
|
43
50
|
def create_project(self, name: str) -> Dict[str, Any]:
|
|
@@ -57,28 +64,17 @@ class ApiClient:
|
|
|
57
64
|
response = self._request("GET", "projects")
|
|
58
65
|
return response.get("projects", [])
|
|
59
66
|
|
|
60
|
-
def start_project(self, project_id: str) -> Dict[str, Any]:
|
|
61
|
-
"""Start a project"""
|
|
62
|
-
return self._request("POST", f"projects/{project_id}/start")
|
|
63
|
-
|
|
64
|
-
def stop_project(self, project_id: str) -> Dict[str, Any]:
|
|
65
|
-
"""Stop a project"""
|
|
66
|
-
return self._request("POST", f"projects/{project_id}/stop")
|
|
67
|
-
|
|
68
|
-
def restart_project(self, project_id: str) -> Dict[str, Any]:
|
|
69
|
-
"""Restart a project"""
|
|
70
|
-
return self._request("POST", f"projects/{project_id}/restart")
|
|
71
|
-
|
|
72
67
|
def delete_project(self, project_id: str) -> Dict[str, Any]:
|
|
73
68
|
"""Delete a project and all its computers"""
|
|
74
|
-
return self._request("
|
|
69
|
+
return self._request("DELETE", f"projects/{project_id}")
|
|
75
70
|
|
|
76
71
|
# Computer methods
|
|
77
|
-
def create_computer(self,
|
|
72
|
+
def create_computer(self, project_id: str, computer_name: str,
|
|
78
73
|
os: str = "linux", ram: int = 2, cpu: int = 2,
|
|
79
74
|
gpu: str = "none") -> Dict[str, Any]:
|
|
80
75
|
"""Create a new computer within a project"""
|
|
81
|
-
return self._request("POST",
|
|
76
|
+
return self._request("POST", "computers", {
|
|
77
|
+
"project_id": project_id,
|
|
82
78
|
"name": computer_name,
|
|
83
79
|
"os": os,
|
|
84
80
|
"ram": ram,
|
|
@@ -86,10 +82,10 @@ class ApiClient:
|
|
|
86
82
|
"gpu": gpu
|
|
87
83
|
})
|
|
88
84
|
|
|
89
|
-
def list_computers(self,
|
|
85
|
+
def list_computers(self, project_id: str) -> List[Dict[str, Any]]:
|
|
90
86
|
"""List all computers in a project"""
|
|
91
|
-
|
|
92
|
-
return
|
|
87
|
+
project = self.get_project(project_id)
|
|
88
|
+
return project.get("desktops", [])
|
|
93
89
|
|
|
94
90
|
def get_computer(self, computer_id: str) -> Dict[str, Any]:
|
|
95
91
|
"""Get computer details"""
|
|
@@ -99,14 +95,6 @@ class ApiClient:
|
|
|
99
95
|
"""Delete a computer"""
|
|
100
96
|
return self._request("DELETE", f"computers/{computer_id}")
|
|
101
97
|
|
|
102
|
-
def start_computer(self, computer_id: str) -> Dict[str, Any]:
|
|
103
|
-
"""Start a computer"""
|
|
104
|
-
return self._request("POST", f"computers/{computer_id}/start")
|
|
105
|
-
|
|
106
|
-
def stop_computer(self, computer_id: str) -> Dict[str, Any]:
|
|
107
|
-
"""Stop a computer"""
|
|
108
|
-
return self._request("POST", f"computers/{computer_id}/stop")
|
|
109
|
-
|
|
110
98
|
def restart_computer(self, computer_id: str) -> Dict[str, Any]:
|
|
111
99
|
"""Restart a computer"""
|
|
112
100
|
return self._request("POST", f"computers/{computer_id}/restart")
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
"""Computer class for interacting with Orgo virtual environments"""
|
|
2
|
-
import os
|
|
3
|
-
import io
|
|
2
|
+
import os as operating_system
|
|
4
3
|
import base64
|
|
5
4
|
import logging
|
|
6
5
|
import uuid
|
|
@@ -50,7 +49,7 @@ class Computer:
|
|
|
50
49
|
# Connect to existing computer in project
|
|
51
50
|
computer = Computer(project="manus")
|
|
52
51
|
"""
|
|
53
|
-
self.api_key = api_key or
|
|
52
|
+
self.api_key = api_key or operating_system.environ.get("ORGO_API_KEY")
|
|
54
53
|
self.base_api_url = base_api_url
|
|
55
54
|
self.api = ApiClient(self.api_key, self.base_api_url)
|
|
56
55
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"""Project class for managing Orgo projects"""
|
|
2
|
-
import os
|
|
2
|
+
import os as operating_system # Renamed to avoid any potential conflicts
|
|
3
3
|
import uuid
|
|
4
4
|
from typing import Dict, List, Any, Optional
|
|
5
5
|
|
|
@@ -18,7 +18,7 @@ class Project:
|
|
|
18
18
|
api_key: Orgo API key (defaults to ORGO_API_KEY env var)
|
|
19
19
|
base_api_url: Custom API URL (optional)
|
|
20
20
|
"""
|
|
21
|
-
self.api_key = api_key or
|
|
21
|
+
self.api_key = api_key or operating_system.environ.get("ORGO_API_KEY")
|
|
22
22
|
self.base_api_url = base_api_url
|
|
23
23
|
self.api = ApiClient(self.api_key, self.base_api_url)
|
|
24
24
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|