jjyq app登录接口报:“内容类型不支持”???

1.在 app上进行登录操作,成功。

2.通过fiddler抓包得到jjyq登录接口的url、param、header。

3.在pycharm中使用requests发起请求,运行报错:内容类型不支持?

import requests

Logger=My_Log()

class HttpRequest:
    def __init__(self,url,param,head=None):
        self.url=url
        self.param=param
        self.head=head

    def httprequest(self,method,cookies=None):
        try:
            if method.upper()=='GET':
                response=requests.get(self.url,self.param,headers=self.head,cookies=cookies,verify=False)
                return response
            elif method.upper()=='POST':
                response=requests.post(self.url,self.param,headers=self.head,cookies=cookies,verify=False)
                return response
        except Exception as e:
            print("请求出错为%s"%e)
            raise e


if __name__ == '__main__':
    url='https://www.1v1.one:1443/hxj_srv/customer/quick_login'
    param={"deviceId":"decffbcb-8756-3c2d-af09-335d9a790003","loginType":"0","source":"zzwbd","appSource":"zzw","channel":"android","code":"666666","mobile":"17612776696"}
    head={
        "androidId": "d4b71da4209cabd9",
        "seriaNumber": "e2a1b47a",
        "imei": "862124035935944",
        "macAddress": "26:07:C0:EE:09:5F",
        "Authorization":"",
        "netType": "wifi",
        "deviceType": "MI MAX",
        "osVersion": "6.0.1",
        "gps":"0.0,0.0",
        "appVersion":"2.5.14",
        "appType":"android",
        "deviceId":"decffbcb-8756-3c2d-af09-335d9a790003",
        "authChannel": "jjyq",
        "Content-Type": "application/json; charset=utf-8",
        "Content-Length": "161",
        "Host":"www.1v1.one:1443",
        "Connection": "Keep-Alive",
        "Accept-Encoding": "gzip",
        "User-Agent": "okhttp/3.11.0"
         }
    result=HttpRequest(url,param).httprequest('post')
    print(result.json())
View Code

猜你喜欢

转载自www.cnblogs.com/qingyuu/p/10020434.html
今日推荐