一、接口获取数据源,并落库
二、拆分、合并、处理表数据
三、处理生成新数据,生成ECSV数据源
四、文件上传至服务器
上传文件接口
def atpUpload(): files = {"file": ( "atpUploadDemo.csv", open("./atpUploadDemo.csv",encoding='utf-8').read(), "application/vnd.ms-excel"), "Content-Type": "application/vnd.ms-excel", "filename": "atpUploadDemo.csv", } url='http://XX/api/v1/case/exec/dataDriverUpload' headers={ "Accept":"application/json, text/plain, */*", "Accept-Encoding":"gzip, deflate", "Accept-Language":"zh-CN,zh;q=0.9", "Connection":"keep-alive", "Content-Length":"1846", "Host":"XX", "Origin":"http://XX", "Referer":"http://XX/", "User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/93.0.4577.82 Safari/537.36", } #datas = dict(env="PRD",type= "") datas= {"env": "PRD", "type":2} result=requests.post(url=url,headers=headers,files=files,data=datas) if __name__ == '__main__': atpUpload()
接口获取经纬度
def getCityCodeGPS_Dest(cityCode): r = requests.get('https://geo.datav.aliyun.com/areas/bound/geojson?code='+cityCode+'_full') data = json.loads(r.text) try: gpsLon = data['features'][1]['properties']['center'][0] gpsLat = data['features'][1]['properties']['center'][1] except: gpsLon = data['features'][1]['geometry']['coordinates'][0][0][0] gpsLat = data['features'][1]['geometry']['coordinates'][0][1][1] return gpsLon, gpsLat
from common.Log import MyLog as Log 写法不完善
修改为 import common.Log.MyLog as Log 即可