其他分享
首页 > 其他分享> > 微胖test

微胖test

作者:互联网

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)

标签:get,alg,urllib,json,result,test,payload,微胖
来源: https://blog.csdn.net/luoganttcc/article/details/117372550