V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
推荐学习书目
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
SpiderXiantang
V2EX  ›  Python

requests 在并发太高的情况下 报错

  •  
  •   SpiderXiantang ·
    xiantang · Aug 3, 2018 · 4118 views
    This topic created in 2837 days ago, the information mentioned may be changed or developed.

    也就开了 32 个线程这样,爬一会就疯狂报错 然后把并发改为 10 之后就可以正常爬了

    requests.exceptions.SSLError: EOF occurred in violation of protocol (_ssl.c:645)
    

    还有个问题:爬虫插入 mysql 的策略是什么? 一定数量批量插 还是一条一条插 感觉一条条插在高并发的情况下十分不稳定

    8 replies    2018-08-04 15:44:30 +08:00
    xxxy
        1
    xxxy  
       Aug 3, 2018
    貌似是 openssl 的限制?
    lhy360121
        2
    lhy360121  
       Aug 3, 2018
    批量插
    lllllllllllllll
        3
    lllllllllllllll  
       Aug 3, 2018
    pip install 'requests[security]'
    nu11001
        4
    nu11001  
       Aug 3, 2018
    试试异步 aiohttp
    SpiderXiantang
        5
    SpiderXiantang  
    OP
       Aug 3, 2018
    @xxxy 后来我发现 我开并发为 10 的情况下也会报错
    SpiderXiantang
        6
    SpiderXiantang  
    OP
       Aug 3, 2018
    @lllllllllllllll 我试试
    awah
        7
    awah  
       Aug 3, 2018 via Android
    @SpiderXiantang 你好,我也遇到这个问题。请问解决了吗?
    SpiderXiantang
        8
    SpiderXiantang  
    OP
       Aug 4, 2018
    @luguhu 安装 requets[security]
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1035 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 39ms · UTC 18:29 · PVG 02:29 · LAX 11:29 · JFK 14:29
    ♥ Do have faith in what you're doing.