ui界面:

request请求模拟导出文件(下载文件)

 

 

实现代码:

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

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-06
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-06-12
  • 2022-03-12
  • 2022-12-23
  • 2022-12-23
  • 2021-06-26
  • 2022-12-23
相关资源
相似解决方案