From 003f60b467a3510e976459524f953c194a99060d Mon Sep 17 00:00:00 2001 From: yumiguan <41277086+yumiguan@users.noreply.github.com> Date: Mon, 29 May 2023 16:31:27 +0800 Subject: [PATCH] Fix mitmproxy fails to start when starting Lyrebird (#759) --- lyrebird/mitm/proxy_server.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lyrebird/mitm/proxy_server.py b/lyrebird/mitm/proxy_server.py index 4cb8dcfac..732fd6afc 100644 --- a/lyrebird/mitm/proxy_server.py +++ b/lyrebird/mitm/proxy_server.py @@ -27,6 +27,7 @@ def show_mitmdump_start_timeout_help(self, mitmdump_filepath, logger): def wait_for_mitm_start(self, config, logger): timeout = 30 wait_time_count = 0 + ip = config.get('ip') mock_port = config.get('mock.port') proxy_port = config.get('proxy.port') while True: @@ -36,8 +37,10 @@ def wait_for_mitm_start(self, config, logger): time.sleep(1) wait_time_count += 1 try: - resp = requests.get(f'http://127.0.0.1:{mock_port}/api/status', - proxies={'http': f'http://127.0.0.1:{proxy_port}'}) + resp = requests.get( + f'http://{ip}:{mock_port}/api/status', + proxies={'http': f'http://{ip}:{proxy_port}'} + ) if resp.status_code != 200: continue else: