Skip to content

Commit

Permalink
Get ip from lyrebird config (#67)
Browse files Browse the repository at this point in the history
* Get ip from lyrebird config

* remove not used import
  • Loading branch information
yumiguan authored Jun 1, 2022
1 parent 4771bea commit 3581986
Showing 1 changed file with 2 additions and 13 deletions.
15 changes: 2 additions & 13 deletions lyrebird_ios/apis.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import os
import socket
import lyrebird
from flask import request, jsonify, send_from_directory
from lyrebird import application
Expand Down Expand Up @@ -43,8 +42,9 @@ def app_list(device_id):

def start_app(device_id, bundle_id):
device = device_service.devices.get(device_id)
ip = application.config.get('ip')
port = application.config.get('mock.port')
res = device.start_app(bundle_id, _get_ip(), port)
res = device.start_app(bundle_id, ip, port)
if res:
return make_fail_response(res)
return make_ok_response()
Expand Down Expand Up @@ -103,14 +103,3 @@ def check_env():
return make_ok_response()
else:
return make_fail_response(msg)


def _get_ip():
"""
Get ip address
:return: IP
"""
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.connect(('bing.com', 80))
return s.getsockname()[0]

0 comments on commit 3581986

Please sign in to comment.