python 网络请求、下载
#获取qq群中的群成员qq号
import requests
members = []
url = 'https://qun.qq.com/cgi-bin/qun_mgr/search_group_members'
data = {'gc':93056308,'st':0,'end':20,'sort':0,'bkn':1780131332}
#end 为获取群中qq的个数 若个数超过40 则需获取多次 第一次 0 - 40 第二次 41-80
cookies = {'cookie':'pgv_pvid=5068418898; pgv_pvi=5954070528; RK=cLgRZwwYY2; ptcz=78e95cf667a2ffdb3d3ffc6f9ac6761499edc9d0017d98c3688b74ca05eaf9ed; ts_uid=2651496228; pac_uid=0_5d5a0945cef7f; pgv_info=ssid=s3263167933; _qpsvr_localtk=0.353670301347206; pgv_si=s4506134528; uin=o0740343919; skey=@KwasjI8j4; ptisp=cm; p_uin=o0740343919; pt4_token=fZD0cTBc7Vv2ewhOTIUciSsdg05AOkhMH66fZXyGFjQ_; p_skey=Fi2u7NF0i7KqHLb6*HPm95W8iiHNdRcNeY*P*JMivtg_; traceid=c8a9d51e8d; ts_last=qun.qq.com/member.html'}
req = requests.post(url,data,headers=cookies)
mem = req.json().get('mems')
for i in mem:
qq = i.get('uin')
members.append(qq)
print(members)
import requests
jpg_url ='https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1576911823&di=b8f93c7fdb79a39e3572b12297fb7957&imgtype=jpg&er=1&src=http%3A%2F%2F5b0988e595225.cdn.sohucs.com%2Fimages%2F20180807%2F88775677a47b43da90bfe25148b65025.jpeg'
req = requests.get(jpg_url)
f = open('桂林.jpg','wb')
f.write(req.content)
f.close() # req.content#返回二进制
# req.json()#返回字典
# req.text #返回字符串
python 网络请求、下载的更多相关文章
- Python网络请求urllib和urllib3详解
Python网络请求urllib和urllib3详解 urllib是Python中请求url连接的官方标准库,在Python2中主要为urllib和urllib2,在Python3中整合成了urlli ...
- python 网络请求类库 requests 使用
python 网络请求类库 requests 使用 requests是 为python封装的强大 REST 操作类库 githubhttps://github.com/kennethreitz/req ...
- 网络请求以及网络请求下载图片的工具类 android开发java工具类
package cc.jiusan.www.utils; import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; ...
- 使用python网络库下载
下载1000次网页资源 1,普通循环方式下载1000次,非常慢 #!/usr/bin/python # -*- coding: utf-8 -*- import sys import os impor ...
- Python 网络请求模块 urllib 、requests
Python 给人的印象是抓取网页非常方便,提供这种生产力的,主要依靠的就是 urllib.requests这两个模块. urlib 介绍 urllib.request 提供了一个 urlopen 函 ...
- python网络请求简洁之道--python requests简介
#requests中文文档:http://cn.python-requests.org/en/latest/#学习出处:http://mp.weixin.qq.com/s?__biz=MjM5NzU0 ...
- Python网络爬虫 - 下载图片
下载博客园的logo from urllib.request import urlretrieve from urllib.request import urlopen from bs4 import ...
- Android开发之java代码工具类。判断当前网络是否连接并请求下载图片
package cc.jiusan.www.utils; import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; ...
- Python网络爬虫笔记(五):下载、分析京东P20销售数据
(一) 分析网页 下载下面这个链接的销售数据 https://item.jd.com/6733026.html#comment 1. 翻页的时候,谷歌F12的Network页签可以看到下面 ...
随机推荐
- DRF项目之通过业务逻辑选择数据集和序列化器
在REST后台开发中,我们需要通过业务逻辑来选择数据集或者序列化器. 选择数据集: # 重写get_queryset实现通过业务逻辑选择指定数据集 def get_queryset(self): '' ...
- Java IO流学习总结(转)
原文地址:http://www.cnblogs.com/oubo/archive/2012/01/06/2394638.html Java流操作有关的类或接口: Java流类图结构: 流的概念和作用 ...
- javaweb利用ajax使登录窗口不跳转页面实现对账号密码的判断
和上一篇判断用户名是否被占用不跳转页面类似!利用ajax实现跳转,要导入jquery文件库!具体代码我会贴出来,注释在里面!!可以观摩一手!(代码我也留下链接,如果失效,评论补发,代码可能导入也无法使 ...
- Sklearn K均值聚类
## 版权所有,转帖注明出处 章节 SciKit-Learn 加载数据集 SciKit-Learn 数据集基本信息 SciKit-Learn 使用matplotlib可视化数据 SciKit-Lear ...
- Java基础之枚举
Java基础之枚举 作为1.5才增加的特性,枚举的使用并不是很多. 枚举其实就是一个比较特殊的类,就如同注解其实也是个特殊的接口一样(注解反编译之后没有了@符号).枚举使用enum关键字声明,通过反编 ...
- Python 日期时间datetime 加一天,减一天,加减一小时一分钟,加减一年
计算年.月.日需要安装组件包 pip install python-dateutil 当前日期时间 import datetime print datetime.datetime.now() # 20 ...
- GIT-Linux(CentOS7)系统安装Git
GIT-Linux(CentOS7)系统安装Git 未成功 查看是否已安装了Git 发现Git版本已存在,说明已安装了Git [root@localhost ~]# rpm -qa|grep git ...
- API网关,让您和Serverless再近一步
从软件行业诞生之日起,技术和业务总是相辅相成.业务的创新促进着软件架构从最早期的单体架构.分布式架构,转变到了如今火热的微服务架构,以及云时代下诞生的Serverless架构.API网关作为单体应用和 ...
- 吴裕雄--天生自然 JAVASCRIPT开发学习:输出
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title> ...
- PAT Advanced A1021 Deepest Root (25) [图的遍历,DFS,计算连通分量的个数,BFS,并查集]
题目 A graph which is connected and acyclic can be considered a tree. The height of the tree depends o ...