• linkedu视频
  • 平面设计
  • 电脑入门
  • 操作系统
  • 办公应用
  • 电脑硬件
  • 动画设计
  • 3D设计
  • 网页设计
  • CAD设计
  • 影音处理
  • 数据库
  • 程序设计
  • 认证考试
  • 信息管理
  • 信息安全
菜单
linkedu.com
  • 网页制作
  • 数据库
  • 程序设计
  • 操作系统
  • CMS教程
  • 游戏攻略
  • 脚本语言
  • 平面设计
  • 软件教程
  • 网络安全
  • 电脑知识
  • 服务器
  • 视频教程
  • vbs
  • DOS/BAT
  • hta/htc
  • python
  • perl
  • VBA
  • ColdFusion
  • ruby
  • PowerShell
  • Lua
  • Golang
  • linux shell
您的位置:首页 > 脚本语言 >python > Python3使用requests发闪存的方法

Python3使用requests发闪存的方法

作者: 字体:[增加 减小] 来源:互联网

通过本文主要向大家介绍了python3 requests,python3 requests安装,python3 requests.get,python3 requests库,python requests方法等相关知识,希望对您有所帮助,也希望大家支持linkedu.com www.linkedu.com

requests是一个python 轻量的http客户端库,相比python的标准库要优雅很多。接下来通过本文给大家介绍Python3使用requests发闪存的方法,一起学习吧。

使用以下命令安装requests

pip install requests
</div>

抓包工具中看到的http头和cookies会多很多项,其中一些是可以省略掉的。比如我省略掉了Content-Length。

import requests
url='http://ing.cnblogs.com/ajax/ing/Publish'
head={'Accept':'application/json, text/javascript, */*; q=0.01',
'Origin':'http://ing.cnblogs.com',
'X-Requested-With':'XMLHttpRequest',
'Content-Type':'application/json; charset=UTF-8',
'DNT':1,
'Referer':'http://ing.cnblogs.com/',
'Accept-Encoding':'gzip, deflate',
'Accept-Language':'zh-CN,zh;q=0.8,en;q=0.6',
}
#session 通过抓包工具,或者cookies工具可以得到.
cookies={'.CNBlogsCookie':'67834BD16E61A87726AF2203F849339E8DEFF67BC4A453FDG830AC373CAC83BAAF2312B975279092095A0E143400E82BBEE189BD5CB8826CA6A6E836F69EC5783C410C2B815A833D5816CEB5B457B159A38F'}#←_←填你自己的session
data={"content":"[天上的星星不说话]python大法好{}","publicFlag":1}
s=requests.Session()
for r in range(1,122):
data['content']="[天上的星星不说话]python大法好{}".format(r)
post=s.post(url,data,cookies=cookies)
print(post.text)
</div>

以下代码用于删除闪存

import requests
import re
def timeit(fn):
import time
def v():
start=time.clock()
fn()
end=time.clock()-start
print(fn.__name__,"运行耗时:",end)
return v
url='http://ing.cnblogs.com/ajax/ing/GetIngList?IngListType=my&PageIndex=1&PageSize=30'
head={'Accept':'application/json, text/javascript, */*; q=0.01',
'Origin':'http://ing.cnblogs.com',
'X-Requested-With':'XMLHttpRequest',
'Content-Type':'application/json; charset=UTF-8',
'DNT':1,
'Referer':'http://ing.cnblogs.com/mobile/',
'Accept-Encoding':'gzip, deflate',
'Accept-Language':'zh-CN,zh;q=0.8,en;q=0.6',
}
cookies={'.CNBlogsCookie':'989A8F9SF9SF989S982938492849823498239489284989SDF89S89F8E98F9S88E9R89WER898R989R23423J4K2529R8FS7R2K48978S7DF8'}
s=requests.Session()
@timeit
def geting():
data={'ingId':'878581'}
r=s.get(url,cookies=cookies)
text=r.text
ingid=re.findall('''feed_content_(\d+)(.+?天上的星星不说话.+?DelIng)''',text,re.DOTALL)
#ingid=re.findall('''feed_content_(\d+)''',text)
#print(ingid) 
notlucky=[a for a,b in ingid if 'ing_icon_lucky' not in b]
for x in notlucky:
data['ingId']=x
try:
sdel=s.post("http://ing.cnblogs.com/ajax/ing/del",cookies=cookies,data=data)
print(sdel.text)
except:
pass
for xxx in range(18):
geting()
</div>

</div>

您可能想查找下面的文章:

  • python中requests小技巧
  • Python的requests网络编程包使用教程
  • Python的requests网络编程包使用教程
  • Python3使用requests发闪存的方法
  • Python3控制路由器——使用requests重启极路由.py
  • Python3使用requests登录人人影视网站的方法
  • Python Requests安装与简单运用
  • Python3使用requests包抓取并保存网页源码的方法
  • Python3使用requests包抓取并保存网页源码的方法
  • python中requests模块的使用方法

相关文章

  • pymssql ntext字段调用问题解决方法
  • python检查序列seq是否含有aset中项的方法
  • Python之父谈Python的未来形式
  • Python使用cx_Oracle模块将oracle中数据导出到csv文件的方法
  • 介绍Python中的__future__模块
  • Python 爬虫爬取指定博客的所有文章
  • Python爬取qq music中的音乐url及批量下载
  • pycharm中连接mysql数据库的步骤详解
  • python中将阿拉伯数字转换成中文的实现代码
  • python中子类继承父类的__init__方法实例

文章分类

  • vbs
  • DOS/BAT
  • hta/htc
  • python
  • perl
  • VBA
  • ColdFusion
  • ruby
  • PowerShell
  • Lua
  • Golang
  • linux shell

最近更新的内容

    • Python中__init__.py文件的作用详解
    • Python中最常用的操作列表的几种方法归纳
    • 简单讲解Python中的字符串与字符串的输入输出
    • Python数组遍历的简单实现方法小结
    • 理解Python中函数的参数
    • Python列表生成器的循环技巧分享
    • Python实现随机生成任意数量车牌号
    • 详解Python中的__new__、__init__、__call__三个特殊方法
    • python有证书的加密解密实现方法
    • python实现将html表格转换成CSV文件的方法

关于我们 - 联系我们 - 免责声明 - 网站地图

©2020-2025 All Rights Reserved. linkedu.com 版权所有