@@ -42,7 +42,7 @@ class APIClientArgs:
42
42
def __init__ (self , port = None , fingerprint = None , sid = None , server = "127.0.0.1" , http_debug_level = 0 ,
43
43
api_calls = None , debug_file = "" , proxy_host = None , proxy_port = 8080 ,
44
44
api_version = None , unsafe = False , unsafe_auto_accept = False , context = "web_api" , single_conn = True ,
45
- user_agent = "python-api-wrapper" , sync_frequency = 2 ):
45
+ user_agent = "python-api-wrapper" , sync_frequency = 2 , cloud_mgmt_id = "" ):
46
46
self .port = port
47
47
# management server fingerprint
48
48
self .fingerprint = fingerprint
@@ -74,6 +74,8 @@ def __init__(self, port=None, fingerprint=None, sid=None, server="127.0.0.1", ht
74
74
self .user_agent = user_agent
75
75
# Interval size in seconds of the task update
76
76
self .sync_frequency = sync_frequency
77
+ # Smart-1 Cloud management UID
78
+ self .cloud_mgmt_id = cloud_mgmt_id
77
79
78
80
79
81
class APIClient :
@@ -124,6 +126,8 @@ def __init__(self, api_client_args=None):
124
126
self .user_agent = api_client_args .user_agent
125
127
# Interval size in seconds of the task update
126
128
self .sync_frequency = api_client_args .sync_frequency
129
+ # Smart-1 Cloud management UID
130
+ self .cloud_mgmt_id = api_client_args .cloud_mgmt_id
127
131
128
132
def __enter__ (self ):
129
133
return self
@@ -318,7 +322,18 @@ def api_call(self, command, payload=None, sid=None, wait_for_task=True, timeout=
318
322
319
323
# init https connection. if single connection is True, use last connection
320
324
conn = self .get_https_connection ()
321
- url = "/" + self .context + "/" + (("v" + str (self .api_version ) + "/" ) if self .api_version else "" ) + command
325
+
326
+ url = ""
327
+ if self .cloud_mgmt_id != "" :
328
+ url += "/" + self .cloud_mgmt_id
329
+
330
+ url += "/" + self .context
331
+
332
+ if self .api_version :
333
+ url += "/v" + str (self .api_version )
334
+
335
+ url += "/" + command
336
+
322
337
response = None
323
338
try :
324
339
# Send the data to the server
0 commit comments