Skip to content

Commit

Permalink
Get ip from lyrebird config (#78)
Browse files Browse the repository at this point in the history
  • Loading branch information
yumiguan authored Jun 1, 2022
1 parent e72c104 commit 6453217
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 12 deletions.
12 changes: 1 addition & 11 deletions lyrebird_android/apis.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ def _format_config(config):
config_str = json.dumps(config, ensure_ascii=False)
template = jinja2.Template(config_str)
formated_config_str = template.render(
ip=get_ip(),
ip=application.config.get('ip'),
port=application.config.get('mock.port')
)
formated_config_str = formated_config_str.encode('utf-8')
Expand Down Expand Up @@ -349,13 +349,3 @@ def search_app():

matched_apps = [app for app in origin_app_list if search_str in app['name']]
return make_ok_response(applist=matched_apps)

def get_ip():
"""
获取当前设备在网络中的ip地址
:return: IP地址字符串
"""
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.connect(('bing.com', 80))
return s.getsockname()[0]
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

setup(
name='lyrebird-android',
version='0.5.12',
version='0.5.13',
packages=['lyrebird_android'],
url='https://github.com/meituan/lyrebird-android',
author='HBQA',
Expand Down

0 comments on commit 6453217

Please sign in to comment.