摘要: Requests库主要方法解析requests.request() 构造一个请求,支撑以下各方法的基础方法 requests.request(method, url, **kwargs)method: 请求方式,对应get/put/post等七种url:拟获取页面的url链接**kwargs: 控制 阅读全文
posted @ 2018-08-01 22:00 cindy_zl 阅读(403) 评论(0) 推荐(1) 编辑
摘要: HTTP协议:超文本传输协议。HTTP是一个基于“请求与响应”模式的、无状态的应用层协议。HTTP协议采用URL作为定位网络资源的标识。URL格式: http://host[:port][path]host: 合法的Internet主机域名或IP地址port: 端口号,缺省端口为80path: 请求 阅读全文
posted @ 2018-08-01 20:10 cindy_zl 阅读(332) 评论(0) 推荐(0) 编辑
摘要: python—网络爬虫(爬取网页的通用代码框架) 理解Requests库的异常 爬取网页的通用代码框架: >>> import requests>>> def getHTMLText(url):... try:... r=requests.get(url,timeout=30)... r.raise 阅读全文
posted @ 2018-08-01 19:22 cindy_zl 阅读(439) 评论(0) 推荐(0) 编辑
摘要: Requests库的七个主要方法 r = requests.get(url) : 构造一个向服务器请求资源的Request对象(Request),并且get方法返回一个包含服务器资源的Response对象; requests.get函数的完整参数如下: requests.get(url, param 阅读全文
posted @ 2018-08-01 18:45 cindy_zl 阅读(1655) 评论(0) 推荐(0) 编辑