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
1
mengzx OP 求支持,求解答
|