V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
bin123485
V2EX  ›  Python

python 如何下载验证码图片?

  •  
  •   bin123485 · 2016-03-04 10:38:12 +08:00 · 3005 次点击
    这是一个创建于 2987 天前的主题,其中的信息可能已经有所发展或是发生改变。

    比如说网易邮箱注册页面
    http://reg.email.163.com/unireg/call.do?cmd=register.entrance&from=163mail_right

    我想要下载验证码图片然后用 ORC 识别,但是识别出来的验证码好像和服务器后端的不一样

    <img id="mVcodeImg" class="vCode" width="120" height="50" alt="验证码" src="/unireg/call.do?cmd=register.verifyCode&v=common/verifycode/vc_en&vt=mobile_acode&t=1457058837406" style="cursor:pointer;">页面源代码这里 t=1457058837406 好像是动态的,
    那么请问怎样才能正确下载到和服务器一致的验证码图片呢?

    popok
        1
    popok  
       2016-03-04 10:58:44 +08:00
    这个 t 就是一个时间戳而已,这个问题不大。主要是 cookie ,你获取验证码时带上你的 cookie ,然后识别完,提交时也用相同的 cookie
    knightdf
        2
    knightdf  
       2016-03-04 12:00:37 +08:00
    不是下验证码图片的问题,下验证码图片只不过是个二进制数据流,而是以"你"的身份去下这个图片的问题
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2116 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 31ms · UTC 16:17 · PVG 00:17 · LAX 09:17 · JFK 12:17
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.