推荐学习书目
› 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
yth492300648
V2EX  ›  Python

网页可以访问 request 提示错误 10060 改如何解决?

  •  
  •   yth492300648 · Apr 11, 2019 · 3613 views
    This topic created in 2733 days ago, the information mentioned may be changed or developed.
    百度上说是防火墙什么之类问题,然而修改了貌似没反应
    脚本功能是论坛自动回帖,可能被发现了?
    6 replies  •  2019-04-12 19:16:15 +08:00
    ssdlh
        1
    ssdlh  
       Apr 11, 2019 via Android
    是不是开了代理。
    ThirdFlame
        2
    ThirdFlame  
       Apr 11, 2019
    10060 貌似是 socket 连接建立失败
    就是 tcp 连接没有通,并没有到 http 阶段
    yth492300648
        3
    yth492300648  
    OP
       Apr 11, 2019
    @ssdlh 没有开代理 因为网页可以上 但是 request.get (添加了 cookies )就会报错了
    yth492300648
        4
    yth492300648  
    OP
       Apr 11, 2019
    @ThirdFlame 有没有什么办法能解决。。。。。因为浏览器确实能打开 requests 就报错了
    iloveyby
        5
    iloveyby  
       Apr 12, 2019
    同样的环境下..浏览器能打开 requests 一定能打开
    将浏览器抓包, 把浏览器请求网站的 request headers 全部弄下来.添加到 requests 里
    代码如下
    headers = {
    "user-agent'':"Mozilla xxx"
    "Content-Type": "htmlxxx"
    ....
    }
    resp = requests.get(url='domain.com',headers=headers)
    print(resp.status_code)
    yth492300648
        6
    yth492300648  
    OP
       Apr 12, 2019
    @iloveyby 好像还是不行
    请求头全部添加了 而且网页访问几次都没有变化 还是出现了 10060
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   2431 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 31ms · UTC 14:25 · PVG 22:25 · LAX 07:25 · JFK 10:25
    ♥ Do have faith in what you're doing.