python后台怎么做验证码登录
答案:2 悬赏:50 手机版
解决时间 2021-03-03 04:34
- 提问者网友:却不属于对方
- 2021-03-02 08:41
python后台怎么做验证码登录
最佳答案
- 五星知识达人网友:第四晚心情
- 2021-03-02 09:16
代码
import urllib
import urllib2
import cookielib
def getImg(picurl):
'''
request for random_code picture and cookie
'''
pic = opener.open(picurl).read()
with open('./verifyImg.jpg','wb') as emptyPic:
emptyPic.write(pic)
def verifyImg(picpath):
import urllib
import urllib2
import cookielib
def getImg(picurl):
'''
request for random_code picture and cookie
'''
pic = opener.open(picurl).read()
with open('./verifyImg.jpg','wb') as emptyPic:
emptyPic.write(pic)
def verifyImg(picpath):
全部回答
- 1楼网友:怀裏藏嬌
- 2021-03-02 10:21
selenium模块调用浏览器chromdriver,这样就是一个可以看见的浏览器,用户可以手动的去填写验证码,然后下面就交给程序去操作了
如果你能采用图像识别,那就不需要用selenium了,用selenium在爬虫中主要目的是加载js文件,
如果能直接抓取登录接口,直接一个post就能搞定!!!
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯