예제 #1
0
def upload(path):
    file = {'file': open(path, 'rb')}
    data = {'name': 'test_3012', 'chunks': '1', 'type': 'game_icon'}
    environment = config.using_huanj()
    if environment == 'test':
        r = requests.post('http://file.local.superdalan.com/upload',
                          data=data,
                          files=file)
    elif environment == 'production':
        r = requests.post('http://file.superdalan.com/upload',
                          data=data,
                          files=file)
    return json.loads(r.text)['data']
예제 #2
0
def get_images(pkg_id, nodeName):
    sign_time = int(time.time())  #获取当前时间戳
    params = {'time': 1578398968, 'pkgId': pkg_id, 'nodeName': nodeName}
    key = 'a0bec9ac4193440a9bd4afc4e38a9b10'
    params['sign'] = _sign(params, key)
    environment = config.using_huanj()
    if environment == 'test':
        r = requests.get(
            'http://pkg.local.superdalan.com/api.pkgFlowReport/data',
            params=params)
    elif environment == 'production':
        r = requests.get('http://pkg.superdalan.com/api.pkgFlowReport/data',
                         params=params)
    json_obj = json.loads(r.text)
    print(json_obj)
예제 #3
0
def select_order(order_id):
    params = {'order_sn': order_id}
    key = '53f25fcd839690707c5c87f58e9715c4'
    params['sign'] = _sign(params, key)
    environment = config.using_huanj()
    print(environment)  #读取环境
    if environment == 'test':
        r = requests.post(
            'http://authorize.local.aidalan.com/v1/PayNew/queryOrderDeliveryStatus',
            data=params)
    elif environment == 'production':
        r = requests.post(
            'https://authorize.aidalan.com/v1/PayNew/queryOrderDeliveryStatus',
            data=params)
    json_obj = json.loads(r.text)
    print(json_obj)
    return json_obj["msg"]
예제 #4
0
def GetScreenbyMiniCap(starttime,devices,action,ssFlipped=False):
    # 先给昵称赋值,防止生成图片的命名格式问题。
    if ":" in devices:
        nickname = devices.split(":")[1]
    else:
        nickname=devices
    #创建图片
    #png='http://file.local.superdalan.com/e327858baca597c0fd3f8a02f9ecf4c3~500'
    #png = screenpath + "\\" + time.strftime("%Y%m%d_%H%M%S_", time.localtime(starttime)) + nickname + "_" + action + ".png"
    #获取设备分辨率
    wmsizecommand = adb + " -s {} shell wm size".format(devices)
    size = os.popen(wmsizecommand).read()
    size = size.split(":")[1].strip()
    if ssFlipped:
        slist = size.split("x")
        size = slist[1] + "x" + slist[0]
    a_path=(os.path.dirname(os.path.dirname(__file__))+'/Report/'+devices+'_test.png')
    if os.path.exists(a_path):
        os.remove(a_path)#删除文件
    chen=a_path
    if devices != 'b5940085':
        #截图并上传PC端
        s_size=size[size.find('x')+1:]+'x'+size[:size.find('x'):]
        if action=="":
            screen=adb  + " -s {} shell \" LD_LIBRARY_PATH=/data/local/tmp /data/local/tmp/minicap -P {}@{}/0 -s > /sdcard/screencap.png\"".format(devices,size, size)
        elif action=="True":
            screen=adb  + " -s {} shell \" LD_LIBRARY_PATH=/data/local/tmp /data/local/tmp/minicap -P {}@{}/0 -s > /sdcard/screencap.png\"".format(devices,s_size,s_size)
        os.system(screen)#执行shell
        time.sleep(1)
    elif devices ==  'b5940085':#android 10不支持minicap
        os.system('adb -s {} shell screencap -p sdcard/screencap.png'.format(devices))
        time.sleep(1)
    os.system(adb + " -s " + devices + " pull /sdcard/screencap.png " +('"' + str(chen) + '"'))#上传截图到PC
    path= img_upload.upload(chen)#上传图片到文件系统
    environment=config.using_huanj()
    if environment=='test':
        png='http://file.local.superdalan.com'+'//'+path+'~500'
    elif environment=='production':
        png='http://file.superdalan.com'+'//'+path+'~500'
    print("<img src='" + png + "' width=600 />")
    print("{}--返回的png为 {}".format(devices,png))
    return png
예제 #5
0
def get_images(pkgId):
    'u' '根据pkg_id获取资源接口__需要签名' ''
    params = {
        'time': int(time.time()),
        'pkgId': pkgId  #998
    }
    key = 'a0bec9ac4193440a9bd4afc4e38a9b10'
    params['sign'] = _sign(params, key)
    environment = config.using_huanj()
    if environment == 'test':
        r = requests.get(
            'http://pkg.local.superdalan.com/api.pkgFlowReport/pkgParam',
            params=params)
    elif environment == 'production':
        r = requests.get(
            'http://pkg.superdalan.com/api.pkgFlowReport/pkgParam',
            params=params)

    json_obj = json.loads(r.text)
    return json_obj