摘要: import osimport requestsfrom bs4 import BeautifulSoupbase_path = os.path.dirname(os.path.abspath(__file__))img1_path = os.path.join(base_path,"img1")r 阅读全文
posted @ 2020-01-17 21:46 干it的小张 阅读(236) 评论(0) 推荐(0) 编辑
摘要: import os#导入发送请求模块:import requests#导入解析文本模块:from bs4 import BeautifulSoup#返回上一级目录:base_path = os.path.dirname(os.path.abspath(__file__))#路径和图片文件夹拼接:im 阅读全文
posted @ 2020-01-17 21:44 干it的小张 阅读(741) 评论(0) 推荐(0) 编辑
摘要: import requests#伪造请求:h = { "user-agent":"Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/53 阅读全文
posted @ 2020-01-17 21:06 干it的小张 阅读(202) 评论(0) 推荐(0) 编辑
摘要: import requestsfrom fake_useragent import UserAgenth = { "user-agent": UserAgent().chrome}response = requests.get(url="https://www.zhihu.com/question/ 阅读全文
posted @ 2020-01-17 20:50 干it的小张 阅读(812) 评论(0) 推荐(0) 编辑
摘要: pip install matplotlib -i http://pypi.douban.com/simple/ pip install matplotlib -i https://pypi.tuna.tsinghua.edu.cn/simplepip install -i https://pypi 阅读全文
posted @ 2020-01-17 20:35 干it的小张 阅读(140) 评论(0) 推荐(0) 编辑
摘要: 楔子 在爬虫中进行request请求,很多时候,都需要添加请求头,不然服务器会认为是非法的请求,从而拒绝你的访问。 import requests url = 'https://www.zhihu.com/question/315387406/answer/812734512' response = 阅读全文
posted @ 2020-01-17 20:26 干it的小张 阅读(204) 评论(0) 推荐(0) 编辑
摘要: import requestsh = { "user-agent":"Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36"} 阅读全文
posted @ 2020-01-17 20:17 干it的小张 阅读(434) 评论(0) 推荐(0) 编辑
摘要: 1、 网址:http://neeo.cc:6002/pinter/bank/page/login 2、 用户名:admin 密码:1234 3、 查看余额 4、 5、 不需要登录的代码和结果如下: p = {"userName":"admin"} response = requests.get(ur 阅读全文
posted @ 2020-01-17 19:13 干it的小张 阅读(674) 评论(0) 推荐(0) 编辑
摘要: import timeimport randomimport getpass# 处理图片from PIL import Imagefrom selenium import webdriverfrom selenium.webdriver.common.action_chains import Act 阅读全文
posted @ 2020-01-17 17:46 干it的小张 阅读(231) 评论(0) 推荐(0) 编辑
摘要: 1、保存图片: import requestsurl = "http://dmimg.5054399.com/allimg/pkm/pk/22.jpg"response = requests.get(url = url)查看状态码: print(response.status_code)查看文本数据 阅读全文
posted @ 2020-01-17 00:26 干it的小张 阅读(481) 评论(0) 推荐(0) 编辑