爬虫pytesseract requests selenium
selenium执行js
```plaintext ### selenium执行js ```python import json import requests from selenium import webdriver from selenium.webdriver.common.by import By import ......
selenium切换选项卡
```plaintext ### selenium切换选项卡 ```python selenium切换选项卡 brower = webdriver.Chrome() brower.get('https://www.pearvideo.com/') brower.implicitly_wait(10) ......
selenium登录cnblogs
```plaintext ### selenium登录cnblogs ```python ''' # 1 打开cnblogs,点进登录页面,输入用户名密码,点登录(可能会出现验证码)--》手动操作 # 2 登录成功后 》拿到cookie 》保存到本地 》关闭浏览器 # 3 开启selenium,打开 ......
selenium前进后退,异常处理
```plaintext ### selenium前进后退,异常处理 ```python brower = webdriver.Chrome() brower.get('https://www.pearvideo.com/') brower.implicitly_wait(10) brower.ma ......
[Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found"
[Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found" vi /etc/yum.repos.d/epel.repo enabled=0vi /etc/yum/pluginconf.d/fastest ......
selenium
Python Automation Scripts Examples Use Django And Selenium Django is the most popular web framework in the python world. You can use it to create a we ......
bs4、selenium的使用
## 爬取新闻 ```python # 1 爬取网页 requests # 2 解析 xml格式,用了re匹配的 html,bs4,lxml。。。 json: -python :内置的 -java : fastjson 》漏洞 -java: 谷歌 Gson -go :内置 基于反射,效率不高 ``` ......
Selenium Grid
用于在不同机器,不同浏览器的并行测试工具 工作原理:selenium scripts发送请求调用hub节点,然后通过hub节点分发到具体的测试用例到node节点执行 环境搭建: 1、文件准备 https://selenium-release.storage.googleapis.com/index. ......
selenium之跳过手机验证码登陆
使用selenium模拟用户登录时,还会碰到这样的情况:每次打开网页,都需要登录。 这个是没什么难度,但如果每次都让你进行人工验证,就很崩溃了,比如前面文章就写了验证码登录,滑块登录,就解决了一部分问题。 但现在又碰到过每次登录都需要输入手机验证码,这不就让人抓狂了嘛!那有什么解决办法呢? 方法1: ......
RequestContextHolder跨线程获取不到requests请求对象的解决方法
# 一、前言 最近在做一个项目,有个比较耗时的操作是启用线程进行异步操作,当时在启用的线程时,突然发现子线程无法获取父线程中的HttpServletRequest请求对象,因为是第一次遇到这种问题,所以记录一下解决方案。 # 二、问题模拟 在这里,我们简单模拟一下出现的问题。我们首先编写一个简单的h ......
了解网络爬虫
理解网络爬虫 1.1网络爬虫的定义 当今最大的网络是互联网,最大的爬虫就是各类搜索引擎,包括谷歌丶百度等。网络爬虫就是按照一定规则去爬去人类所需要的信息的程序,主要通过对URL的请求来实现。一般来说,从搜索引擎这类爬虫搜索到的信息是非常宽泛的,而且夹杂着各种广告,信息是不纯粹的,也有可能不是我们需要 ......
requests高级用法、代理池搭建
## requests高级用法 ### 1.自动携带cookie的session对象 ```python # session对象 》已经模拟登录上了一些网站 》单独把cookie 取出来 import requests header = { 'Referer': 'http://www.aa7a.c ......
requests的基础使用
## 爬虫介绍 ```python # 爬虫:又称网络蜘蛛,spider,一堆程序,从互联网中抓取数据 》数据清洗 >入库 # 爬虫需要掌握的知识 -抓取数据:发送网络请求(http),获得响应(http响应,响应头,响应体 》真正重要的数据在响应体中) -python模块:requests,sel ......
爬虫学习02 requests高级用法
## 1 requests高级用法 ### 1.0 自动携带cookie 的session对象 ```python # session对象 》已经模拟登录上了一些网站 》单独把cookie 取出来 -res.cookies 是cookiejar对象,里面有get_dict()方法转换成字典 -转成字 ......
7.10 requests的高级使用
1. 自动携带cookie和session对象 header={ 'Referer': 'http://www.aa7a.cn/user.php?&ref=http%3A%2F%2Fwww.aa7a.cn%2F', 'User-Agent': 'Mozilla/5.0 (Windows NT 10. ......
爬虫使用
### 爬取新闻 ```python import re import requests from bs4 import BeautifulSoup import pymysql # 建立数据库链接 conn = pymysql.connect( user='root', password="123 ......
python引入selenium报错ImportError: cannot import name 'webdriver' from partially initialized module 'selenium' (most likely due to a circular import)
背景: 新建一个名为:selenium.py的脚本文件,代码如下: from selenium import webdriver browser = webdriver.Chrome() browser.get('https://www.baidu.com/') 实现,我们已经通过pip insta ......
Selenium基础:SSL证书错误处理 13
1、chrome解决办法 在chromeoptions()中添加”--ignore-certificate-errors"为true的选项 #-*-coding: utf-8-*- from selenium import webdriver options = webdriver.ChromeOp ......
Anaconda环境下使用pip install selenium安装失败的解决办法
背景: 在Anaconda环境下执行pip install selenium,一直报time out错误 解决方法: python -m pip install selenium 参考资料: https://blog.csdn.net/qq_45538469/article/details/1138 ......
Selenium基础:配置chrome浏览器 12
1、屏蔽浏览器对selenium的检测 ”chrome正受到自动测试软件的控制。“ 解决方法: options = webdriver.ChromeOptions() options.add_experimental_option('excludeSwitches', ['enable-automa ......
爬虫学习01
## 1 扫码登录功能 ```python # 前端 1 前端进入扫码登录页面 》向后端发送请求 》后端生成二维码图片 》显示在前端,暂存key 2 掏出手机,打开对应的app 》扫描二维码 》app端提示是否登录 》当你点登录 》app能解析出这个地址 》取出你当前app登录的token 》向这个 ......
Selenium基础:其他设置 11
1、限制页面加载时间 设置页面加载限制时间:set_page_load_timeout(time) #-*-coding:utf-8-*- from selenium import webdriver from selenium.common.exceptions import TimeoutExc ......
Selenium基础:时间等待 10
1、强制等待 time.sleep() 指定一个固定的线程休眠时间 #-*-coding:utf-8-*- from datetime import datetime import time print(datatime.now()) #等待5S time.sleep(5) print(datati ......
selenium优雅打开并关闭网页
with 上下文管理器 在python中是这样介绍的所有实现了__enter__ __exit__ dunder method魔术方法的对象都可以用with 接下来以Chrome为例查看底层 def __enter__(self): return self def __exit__(self, ex ......
uniapp request.js请求封装
import Vue from "vue" let startTestModel = true //开启测试模式 const BASE_URL = '' // 接口域名 const IMG_URL = '' // 图片域名 // 声明 测试模式 console.log("%c".concat("开发 ......
[学习笔记]python爬虫初体验
同学吹水,提到了爬虫,于是金工实习回来晚上看了看爬虫 (话说为啥所有爬虫教程前面都是一大串python基础教程啊) ```python import urllib.request #1、定义一个网址url url='http://www.baidu.com' #2、模拟浏览器向服务器发送请求 res ......
requests高级用法 代理池搭建 爬取某视频网站
[toc] ```python # 1 扫码登录 前端 -1 前端进入扫码登录页面 》向后端发送请求,获取一个验证码图片,显示在前端 -把key:1234567暂存 -2 掏出手机扫码 》用自己的app 》扫码 》app端提示是否登录 》当你点登录 》向二维码链接地址发送请求 》http://192 ......
,软件运行监听地址 ,扫码登录,爬虫介绍,requests模块介绍和快速使用,get请求携带参数,编码和解码,携带请求头,发送post请求携带数据,携带cookie两种方式
# 补充 ```python # 软件运行,监听地址 127.0.0.1 只能访问 127.0.0.1 localhost 不能用本机ip地址访问,外部所有人都不能 访问你 0.0.0.0 127.0.0.1 localhost 本机ip地址访问 同一个局域网内,都可以通过ip地址访问 # 本地ho ......
爬虫第一天基础
[toc] ## 1 前戏 ``` #介绍:使用requests可以模拟浏览器的请求,比起之前用到的urllib,requests模块的api更加便捷(本质就是封装了urllib3) #注意:requests库发送请求将网页内容下载下来以后,并不会执行js代码,这需要我们自己分析目标站点然后发起新的 ......
requests返回数据的处理
关于编码: resp.encoding = 'utf-8' resp.encoding = 'gbk' 关于内容三种方法: 一、etree.HTML(resp.text).xpath(): 1、参考网站未整理: https://www.jianshu.com/p/4d3c9cae5470https: ......