![](https://img-blog.csdnimg.cn/20201014180756918.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
爬虫
AIRBOYONE
ACM
展开
-
Python网络爬虫—请求头
注意事项: header一定要根据自己浏览器和爬虫网址配(已配图!) response.status_code返回值为200才说明网页正常打开 requests.get()写在 try/except 内,否则偶尔会抛异常 except Exception 抛异常时,要有解决方法 定义uft-8编码格式或者其他 requests库方法:https://www.cnblogs.com/mz...原创 2019-08-27 10:42:39 · 2579 阅读 · 0 评论 -
Python爬虫获取ip所在地理位置
# -*- coding: utf-8 -*- import re import requests from requests.exceptions import ReadTimeout, HTTPError, RequestException def Searchip(ip): url = 'https://ip.cn/?ip=' + ip # 请求头 header...原创 2020-03-29 13:05:19 · 1188 阅读 · 0 评论