import json
import urllib
ledi = 'http://34.67.233.13:1088'
def get_alg_result(url, payload, timeout=1.5):
result = {}
try:
req = urllib.request.Request(
method='POST', url=url,
data=urllib.parse.urlencode(payload).encode('utf-8')
)
resp = urllib.request.urlopen(req, timeout=timeout)
result = json.loads(resp.read().decode('utf-8'))
except Exception as err:
print('Failed to get alg result: {}'.format(err))
return result
price_level = [-1]
payload = {'status': json.dumps(status), 'price_level': ['4.99']}
get_alg_result(ledi, payload)