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
Chyroc
V2EX  ›  Python

咨询: requests 库代理问题

  •  
  •   Chyroc · 2016-05-10 15:38:51 +08:00 · 2518 次点击
    这是一个创建于 2901 天前的主题,其中的信息可能已经有所发展或是发生改变。

    代码

    ip = get_ip() #ip 是通过 http://ip84.com/dlgn-http 获取的,已用百度测试连通过,格式: http://1.1.1.1:8080
    proxies = {
        'http'   : ip,
        'https' : ip
    }
    r = requests.get(url, headers=headers, proxies=proxies)
    

    但是去 get 目标网页,仍然显示操作频繁的提示,怎么办?

    2 条回复    2016-05-11 15:16:24 +08:00
    SlipStupig
        1
    SlipStupig  
       2016-05-10 19:09:20 +08:00
    考虑 user-agent 头 x-forward-for 头,因为有些代理是透明代理会出卖你的
    linsun84
        2
    linsun84  
       2016-05-11 15:16:24 +08:00
    x-forward-for 也不一定,不同代理服务器的设置都不一样,头也不同, 尤其是公开的 proxy list 上来的。

    我的建议是你自己弄个服务器,先提交给自己看看 HTTP 头上有没有啥特殊的东西,再决定用不用。
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   976 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 22:49 · PVG 06:49 · LAX 15:49 · JFK 18:49
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.