码迷,mamicode.com
首页 > 其他好文 > 详细

request请求模拟导出文件

时间:2019-09-10 14:52:21      阅读:103      评论:0      收藏:0      [点我收藏+]

标签:info   int   inf   img   模拟   seconds   输出   logs   htm   

ui界面:

技术图片

 

 

实现代码:

def export(self,host):
‘‘‘导出课时券记录‘‘‘
#测试接口
  url=‘https://‘+host+r‘/ticket-record/export?timespan=1568010189362‘
  #请求头
  heard=self.public()
  #发送请求
  r=self.codemao.request2.get(url,headers=heard)
  # 输出请求时长
  print ‘请求时长:‘,r.elapsed.total_seconds()
  print r.content
  fp = open("yoyo.xls", "wb")
  fp.write(r.content)
  fp.close()

参考:https://www.cnblogs.com/guo2733/p/10542736.html

 

request请求模拟导出文件

标签:info   int   inf   img   模拟   seconds   输出   logs   htm   

原文地址:https://www.cnblogs.com/kaibindirver/p/11497204.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!