色彩时光 | 记录程序员世界的点点滴滴

20170313日常记录


最近整网站的时候碰到两个问题记录下。

1、关于访问url直接生成文本文件的方法。在httpResponse设置contenttype为application/octet-stream即可。
具体代码如下:



    response = HttpResponse(status=200)
    response['Content-Type'] = 'application/octet-stream'
    response['Content-Disposition'] = 'attachment;filename=tjb.bat'


2、关于模拟淘宝登录的方法。
第一种是模拟登陆请求,涉及验证码方便比较麻烦,http://cuiqingcai.com/1076.html
https://github.com/Charles-Lau-/TaobaoLogin

第二种采用selenium 自动化测试框架模拟,不过无法放到云上运行。


您可能也对下面文章感兴趣:

Write a Comment


* Content (required) 10~500s

分类

热门标签

友情链接