stoobly-agent 1.0.3__py3-none-any.whl → 1.0.4__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.
- stoobly_agent/__init__.py +1 -1
- stoobly_agent/app/api/__init__.py +13 -5
- stoobly_agent/cli.py +3 -2
- {stoobly_agent-1.0.3.dist-info → stoobly_agent-1.0.4.dist-info}/METADATA +1 -1
- {stoobly_agent-1.0.3.dist-info → stoobly_agent-1.0.4.dist-info}/RECORD +8 -8
- {stoobly_agent-1.0.3.dist-info → stoobly_agent-1.0.4.dist-info}/LICENSE +0 -0
- {stoobly_agent-1.0.3.dist-info → stoobly_agent-1.0.4.dist-info}/WHEEL +0 -0
- {stoobly_agent-1.0.3.dist-info → stoobly_agent-1.0.4.dist-info}/entry_points.txt +0 -0
stoobly_agent/__init__.py
CHANGED
@@ -1,2 +1,2 @@
|
|
1
1
|
COMMAND = 'stoobly-agent'
|
2
|
-
VERSION = '1.0.
|
2
|
+
VERSION = '1.0.4'
|
@@ -3,28 +3,36 @@ import pdb
|
|
3
3
|
import threading
|
4
4
|
|
5
5
|
from http.server import HTTPServer
|
6
|
+
from urllib.parse import urlparse
|
6
7
|
|
7
8
|
from stoobly_agent.app.settings import Settings
|
8
9
|
from stoobly_agent.config.constants import env_vars
|
10
|
+
from stoobly_agent.lib.logger import Logger
|
9
11
|
|
10
12
|
from .application_http_request_handler import ApplicationHTTPRequestHandler
|
11
13
|
|
14
|
+
LOG_ID = 'UI'
|
15
|
+
|
12
16
|
def start_server(host, port):
|
13
17
|
httpd = HTTPServer((host, port), ApplicationHTTPRequestHandler)
|
14
18
|
httpd.serve_forever()
|
15
19
|
|
16
|
-
def
|
17
|
-
ui_host = kwargs['ui_host']
|
18
|
-
ui_port = kwargs['ui_port']
|
20
|
+
def initialize(**kwargs):
|
19
21
|
url = f"http://{kwargs['ui_host']}:{kwargs['ui_port']}"
|
20
22
|
|
21
23
|
os.environ[env_vars.AGENT_URL] = url
|
22
24
|
|
25
|
+
# TODO: debug why the following is needed or else logger won't print
|
23
26
|
settings = Settings.instance()
|
24
27
|
settings.ui.url = url
|
25
28
|
settings.commit()
|
26
29
|
|
27
|
-
|
30
|
+
return url
|
31
|
+
|
32
|
+
def run(url):
|
33
|
+
parsed_url = urlparse(url)
|
34
|
+
|
35
|
+
Logger.instance(LOG_ID).info(f"Server listening at {url}\n")
|
28
36
|
|
29
|
-
thread = threading.Thread(target=start_server, args=(
|
37
|
+
thread = threading.Thread(target=start_server, args=(parsed_url.hostname, parsed_url.port))
|
30
38
|
thread.start()
|
stoobly_agent/cli.py
CHANGED
@@ -15,7 +15,7 @@ from stoobly_agent.config.constants import env_vars, mode
|
|
15
15
|
from stoobly_agent.config.data_dir import DataDir
|
16
16
|
from stoobly_agent.lib.utils.conditional_decorator import ConditionalDecorator
|
17
17
|
|
18
|
-
from .app.api import run as run_api
|
18
|
+
from .app.api import initialize as initialize_api, run as run_api
|
19
19
|
from .app.cli import ca_cert, config, endpoint, feature, intercept, MainGroup, request, scenario, scaffold, snapshot, trace
|
20
20
|
from .app.cli.helpers.feature_flags import local, remote
|
21
21
|
from .app.settings import Settings
|
@@ -144,8 +144,9 @@ def run(**kwargs):
|
|
144
144
|
if 'api_url' in kwargs and kwargs['api_url']:
|
145
145
|
os.environ[env_vars.API_URL] = kwargs['api_url']
|
146
146
|
|
147
|
+
url = initialize_api(**kwargs)
|
147
148
|
if 'headless' in kwargs and not kwargs['headless']:
|
148
|
-
run_api(
|
149
|
+
run_api(url)
|
149
150
|
|
150
151
|
if 'proxyless' in kwargs and not kwargs['proxyless']:
|
151
152
|
run_proxy(**kwargs)
|
@@ -1,6 +1,6 @@
|
|
1
|
-
stoobly_agent/__init__.py,sha256=
|
1
|
+
stoobly_agent/__init__.py,sha256=f1FfF5ji8VyTsfUz9vkoZmCunEPoXdrww6rk9uifrKo,44
|
2
2
|
stoobly_agent/app/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
3
|
-
stoobly_agent/app/api/__init__.py,sha256=
|
3
|
+
stoobly_agent/app/api/__init__.py,sha256=ctkB8KR-eXO0SFhj602huHiyvQ3PslFWd8fkcufgrAI,1000
|
4
4
|
stoobly_agent/app/api/application_http_request_handler.py,sha256=jf4fkqjOiCeI2IM5Ro7ie0v_C6y0-7-5TIE_IKMPOfg,5513
|
5
5
|
stoobly_agent/app/api/bodies_controller.py,sha256=TmN82Q7OFjWiIszwUzfYHQqsqCwLLrThXcIfQmNgvTo,2285
|
6
6
|
stoobly_agent/app/api/configs_controller.py,sha256=wkO3_9cexH7BKwm_2KflKEEdxvBFwc9vju_wouUjjBI,4692
|
@@ -391,7 +391,7 @@ stoobly_agent/app/settings/types/remote_settings.py,sha256=4PvEGKULXM0zv29XTDzV7
|
|
391
391
|
stoobly_agent/app/settings/types/ui_settings.py,sha256=BqPy2F32AbODqzi2mp2kRk28QVUydQIwVmvftn46pco,84
|
392
392
|
stoobly_agent/app/settings/ui_settings.py,sha256=YDEUMPuJFh0SLHaGz6O-Gpz8nwsunNzeuc-TzO9OUbM,1170
|
393
393
|
stoobly_agent/app/settings/url_rule.py,sha256=Qx7YrIpVRSC-4LeNiCAfCtE50Jou4423hojMW-4qUYg,954
|
394
|
-
stoobly_agent/cli.py,sha256=
|
394
|
+
stoobly_agent/cli.py,sha256=cZJDCVa7PGGfiqg4GxaYn74-uPtQQAexHeWmGybw3YE,9915
|
395
395
|
stoobly_agent/config/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
396
396
|
stoobly_agent/config/constants/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
397
397
|
stoobly_agent/config/constants/alias_resolve_strategy.py,sha256=_R1tVqFnyGxCraVS5-dhSskaDj_X8-NthsY7i_bEt9M,119
|
@@ -707,8 +707,8 @@ stoobly_agent/test/mock_data/petstore.yaml,sha256=CCdliJky04Az4FIOkFA883uunwFDHL
|
|
707
707
|
stoobly_agent/test/mock_data/request_show_response.py,sha256=K_a0fP0QT58T8sX9PaM6hqtX1A1depZsqg_GsNPf--k,707
|
708
708
|
stoobly_agent/test/mock_data/uspto.yaml,sha256=6U5se7C3o-86J4m9xpOk9Npias399f5CbfWzR87WKwE,7835
|
709
709
|
stoobly_agent/test/test_helper.py,sha256=m_oAI7tmRYCNZdKfNqISWhMv3e44tjeYViQ3nTUfnos,1007
|
710
|
-
stoobly_agent-1.0.
|
711
|
-
stoobly_agent-1.0.
|
712
|
-
stoobly_agent-1.0.
|
713
|
-
stoobly_agent-1.0.
|
714
|
-
stoobly_agent-1.0.
|
710
|
+
stoobly_agent-1.0.4.dist-info/LICENSE,sha256=8QKGyy45eN76Zk52h8gu1DKX2B_gbWgZ3nzDLofEbaE,548
|
711
|
+
stoobly_agent-1.0.4.dist-info/METADATA,sha256=Kmm6NvSM_24nSEOEQ65tHBzXE4UB3qMO9dwClO_Qk9o,3388
|
712
|
+
stoobly_agent-1.0.4.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
|
713
|
+
stoobly_agent-1.0.4.dist-info/entry_points.txt,sha256=aq5wix5oC8MDQtmyPGU0xaFrsjJg7WH28NmXh2sc3Z8,56
|
714
|
+
stoobly_agent-1.0.4.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|