Пример #1
0
def httpPost():
    cf = configparser.ConfigParser()
    cf.read('config.ini', encoding="utf-8-sig")
    urlstring = cf.get('AddLocation', 'url')
    latitude = cf.get('AddLocation', 'latitude')
    address = cf.get('AddLocation', 'address')
    deviceId = cf.get('AddLocation', 'deviceId')
    locationTime = time.strftime('%Y-%m-%d %H:%M:%S',
                                 time.localtime(time.time()))
    longitude = cf.get('AddLocation', 'longitude')
    deviceVersion = cf.get('AddLocation', 'deviceVersion')
    version = cf.get('AddLocation', 'version')
    user_agent = 'Mozilla/5.0 (iPhone; CPU iPhone OS 6_1_3 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Mobile/10B329 MicroMessenger/5.0.1'
    reponsestring = eval(Login.HttpLoginDriver())
    sessionId = reponsestring['data']['customerInfo']['sessionId']
    headers = {'User-Agent': user_agent, 'sessionId': sessionId}
    data = {
        'latitude': latitude,
        'address': address,
        'deviceId': deviceId,
        'locationTime': locationTime,
        'longitude': longitude,
        'deviceVersion': deviceVersion,
        'version': version
    }
    response = requests.post(urlstring, data=data, headers=headers)
    return response.text
Пример #2
0
def httpPostDriver(idcardnumber, idcardname):
    urlstring = cf.get('VerifyIdcard', 'url')
    user_agent = 'Mozilla/5.0 (iPhone; CPU iPhone OS 6_1_3 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Mobile/10B329 MicroMessenger/5.0.1'
    reponsestring = eval(Login.HttpLoginDriver())
    sessionId = reponsestring['data']['customerInfo']['sessionId']
    headers = {'User-Agent': user_agent, 'sessionId': sessionId}
    idcardnumber = idcardnumber
    idcardname = idcardname
    data = {'idcardName': idcardname, 'idcardNumber': idcardnumber}
    response = requests.post(urlstring, data=data, headers=headers)
    return response.text
Пример #3
0
def HttpIndexInfoDriver():  #获取司机首页广告语
    cf = configparser.ConfigParser()
    cf.read('config.ini', encoding="utf-8-sig")
    urlstring = cf.get('IndexInfo', 'driver_url')
    reponsestring = eval(Login.HttpLoginDriver())
    pdata = ''
    #user_agent='Mozilla/5.0 (Linux; U; Android 2.3.6; zh-cn; GT-S5660 Build/GINGERBREAD) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1 MicroMessenger/4.5.255'
    user_agent = 'Mozilla/5.0 (iPhone; CPU iPhone OS 6_1_3 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Mobile/10B329 MicroMessenger/5.0.1'
    sessionId = reponsestring['data']['customerInfo']['sessionId']
    headers = {'User-Agent': user_agent, 'sessionId': sessionId}
    req = urllib.request.Request(url=urlstring,
                                 data=pdata.encode("UTF-8"),
                                 headers=headers)
    response = urllib.request.urlopen(req)
    the_page = response.read()
    return the_page.decode('utf-8')
Пример #4
0
def HttpGetLatestIOSDriver():
	cf=configparser.ConfigParser()
	cf.read('config.ini',encoding="utf-8-sig")
	urlstring=cf.get('getLatest','url')
	device=cf.get('getLatest','device2')
	versionType=cf.get('getLatest','versiontype1')
	sqlscript='SELECT version from app_version where device='+device+' and version_type='+versionType
	current=DBConn.GetConnection(sqlscript)
	reponsestring=eval(Login.HttpLoginDriver())
	customerId=reponsestring['data']['customerInfo']['customerId']

	values={'device':device,'versionType':versionType,'current':current,'customerId':customerId}
	pdata=urllib.parse.urlencode(values)
	#user_agent='Mozilla/5.0 (Linux; U; Android 2.3.6; zh-cn; GT-S5660 Build/GINGERBREAD) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1 MicroMessenger/4.5.255'
	user_agent='Mozilla/5.0 (iPhone; CPU iPhone OS 6_1_3 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Mobile/10B329 MicroMessenger/5.0.1'
	sessionId=reponsestring['data']['customerInfo']['sessionId']
	headers={'User-Agent':user_agent,'sessionId':sessionId}
	req=urllib.request.Request(url=urlstring,data=pdata.encode("UTF-8"),headers=headers)
	response = urllib.request.urlopen(req) 
	the_page = response.read()
	return the_page.decode('utf-8')
Пример #5
0
def PostDriverInfo():
    cf = configparser.ConfigParser()
    cf.read('config.ini', encoding="utf-8-sig")
    urlstring = cf.get('MoreInfo', 'driver_url')
    headPortrait = cf.get('MoreInfo', 'headPortrait')
    idcardPositive = cf.get('MoreInfo', 'idcardPositive')
    idcardNuber = cf.get('MoreInfo', 'idcardNumber1')
    idcardName = cf.get('MoreInfo', 'idcardName1')
    vehicleLicense = cf.get('MoreInfo', 'vehicleLicense')
    vhicleType = cf.get('MoreInfo', 'vhicleType')
    vehicleLong = cf.get('MoreInfo', 'vehicleLong')
    vehiclePhoto = cf.get('MoreInfo', 'vehiclePhoto')
    drivingLicense = cf.get('MoreInfo', 'drivingLicense')
    mainLine = cf.get('MoreInfo', 'mainLine')
    goodsType = cf.get('MoreInfo', 'goodsType')
    reponsestring = eval(Login.HttpLoginDriver())
    sessionId = reponsestring['data']['customerInfo']['sessionId']
    user_agent = 'Mozilla/5.0 (iPhone; CPU iPhone OS 6_1_3 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Mobile/10B329 MicroMessenger/5.0.1'
    headers = {'User-Agent': user_agent, 'sessionId': sessionId}
    data = {
        'headPortrait': headPortrait,
        'idcardPositive': idcardPositive,
        'idcardNuber': idcardNuber,
        'idcardName': idcardName,
        'vehicleLicense': vehicleLicense,
        'vhicleType': vhicleType,
        'vehicleLong': vehicleLong,
        'vehiclePhoto': vehiclePhoto,
        'drivingLicense': drivingLicense,
        'mainLine': mainLine,
        'goodsType': goodsType
    }
    VerifyIdcard.VerifyIdcardDriver(idcardNuber, idcardName)
    UploadPic.UploadPic()
    response = requests.post(urlstring, data=data, headers=headers)
    return response.text