uipath 2.1.3__py3-none-any.whl → 2.1.5__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.
uipath/_cli/__init__.py CHANGED
@@ -10,6 +10,7 @@ from .cli_invoke import invoke as invoke # type: ignore
10
10
  from .cli_new import new as new # type: ignore
11
11
  from .cli_pack import pack as pack # type: ignore
12
12
  from .cli_publish import publish as publish # type: ignore
13
+ from .cli_push import push as push # type: ignore
13
14
  from .cli_run import run as run # type: ignore
14
15
 
15
16
 
@@ -63,3 +64,4 @@ cli.add_command(run)
63
64
  cli.add_command(deploy)
64
65
  cli.add_command(auth)
65
66
  cli.add_command(invoke)
67
+ cli.add_command(push)
@@ -1,10 +1,12 @@
1
+ import asyncio
1
2
  import http.server
2
3
  import json
3
4
  import os
4
5
  import socketserver
6
+ import threading
5
7
  import time
8
+ from typing import Optional
6
9
 
7
- import click
8
10
  from dotenv import load_dotenv
9
11
 
10
12
  from ._oidc_utils import get_auth_config
@@ -117,9 +119,11 @@ class HTTPServer:
117
119
  """
118
120
  self.current_path = os.path.dirname(os.path.abspath(__file__))
119
121
  self.port = port
120
- self.httpd = None
122
+ self.httpd: Optional[socketserver.TCPServer] = None
121
123
  self.token_data = None
122
124
  self.should_shutdown = False
125
+ self.token_received_event: Optional[asyncio.Event] = None
126
+ self.loop = None
123
127
 
124
128
  def token_received_callback(self, token_data):
125
129
  """Callback for when a token is received.
@@ -128,7 +132,8 @@ class HTTPServer:
128
132
  token_data (dict): The received token data.
129
133
  """
130
134
  self.token_data = token_data
131
- self.should_shutdown = True
135
+ if self.token_received_event and self.loop:
136
+ self.loop.call_soon_threadsafe(self.token_received_event.set)
132
137
 
133
138
  def create_server(self, state, code_verifier, domain):
134
139
  """Create and configure the HTTP server.
@@ -149,7 +154,16 @@ class HTTPServer:
149
154
  self.httpd = socketserver.TCPServer(("", self.port), handler)
150
155
  return self.httpd
151
156
 
152
- def start(self, state, code_verifier, domain):
157
+ def _run_server(self):
158
+ """Run server loop in thread."""
159
+ try:
160
+ while not self.should_shutdown and self.httpd:
161
+ self.httpd.handle_request()
162
+ except Exception:
163
+ # Server might be closed, that's fine
164
+ pass
165
+
166
+ async def start(self, state, code_verifier, domain):
153
167
  """Start the server.
154
168
 
155
169
  Args:
@@ -163,12 +177,16 @@ class HTTPServer:
163
177
  if not self.httpd:
164
178
  self.create_server(state, code_verifier, domain)
165
179
 
180
+ self.token_received_event = asyncio.Event()
181
+ self.loop = asyncio.get_event_loop()
182
+
183
+ # Run server in daemon thread
184
+ server_thread = threading.Thread(target=self._run_server, daemon=True)
185
+ server_thread.start()
186
+
166
187
  try:
167
- if self.httpd:
168
- while not self.should_shutdown:
169
- self.httpd.handle_request()
170
- except KeyboardInterrupt:
171
- click.echo("Process interrupted by user")
188
+ # Wait indefinitely for token received event or interrupt
189
+ await self.token_received_event.wait()
172
190
  finally:
173
191
  self.stop()
174
192
 
@@ -176,6 +194,7 @@ class HTTPServer:
176
194
 
177
195
  def stop(self):
178
196
  """Stop the server gracefully and cleanup resources."""
197
+ self.should_shutdown = True
179
198
  if self.httpd:
180
199
  self.httpd.server_close()
181
200
  self.httpd = None
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "client_id": "36dea5b8-e8bb-423d-8e7b-c808df8f1c00",
3
3
  "redirect_uri": "http://localhost:__PY_REPLACE_PORT__/oidc/login",
4
- "scope": "offline_access OrchestratorApiUserAccess IdentityServerApi ConnectionService DataService DocumentUnderstanding EnterpriseContextService Directory JamJamApi LLMGateway LLMOps OMS RCS.FolderAuthorization TM.Projects TM.TestCases TM.Requirements TM.TestSets",
4
+ "scope": "offline_access OrchestratorApiUserAccess StudioWebBackend IdentityServerApi ConnectionService DataService DocumentUnderstanding EnterpriseContextService Directory JamJamApi LLMGateway LLMOps OMS RCS.FolderAuthorization TM.Projects TM.TestCases TM.Requirements TM.TestSets",
5
5
  "port": 8104
6
- }
6
+ }