为python设置socket代理的方法

WBOY
Release: 2016-06-06 11:20:49
Original
2188 people have browsed it

首先,你得下载SocksiPy这个.解压出来之后里面会有一个socks.py文件.然后你可以把这个文件复制到python安装目录里面的Lib\site-packages中.或者把这个文件复制到程序所在的目录中.
然后就可以再程序中使用socket代理来编写程序了.

下面是示例代码

import socks import socket 
socks.setdefaultproxy(socks.PROXY_TYPE_SOCKS5,"127.0.0.1",8088) 
socket.socket =socks.socksocket import urllib2 
urllib2.urlopen('http://www.baidu.com').read()
Copy after login

原文:为python设置socket代理

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!