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

pysock 使用设定默认代理,导致无法上网

  •  
  •   mengzx · Apr 18, 2017 · 1632 views
    This topic created in 3398 days ago, the information mentioned may be changed or developed.

    import socket import socks import requests

    ip = '127.0.0.1' # change your proxy's ip port = 1080 # change your proxy's port socks.setdefaultproxy(socks.PROXY_TYPE_SOCKS5, ip, port) socket.socket = socks.socksocket url = u'http://ajax.googleapis.com/ajax/services/search/images?v=1.0&q=inurl%E8%A2%8B' print(requests.get(url).text)

    使用 setdefaultproxy 方法导致无法使用 chrome 访问 google.com,见下图 http://wx2.sinaimg.cn/large/006pxShMly1feqo1kjem2j31100l4aco.jpg

    Supplement 1  ·  Apr 18, 2017
    1 replies    2017-04-19 08:39:07 +08:00
    mengzx
        1
    mengzx  
    OP
       Apr 19, 2017 via Android
    求支持,求解答
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2699 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 23ms · UTC 12:28 · PVG 20:28 · LAX 05:28 · JFK 08:28
    ♥ Do have faith in what you're doing.