python实现通过代理服务器访问远程url的方法

yipeiwu_com6年前服务器

本文实例讲述了python实现通过代理服务器访问远程url的方法。分享给大家供大家参考。具体如下:

import urllib
proxies = {'http' : 'http://proxy:80'}
urlopener = urllib.FancyURLopener(proxies)
htmlpage = urlopener.open('http://www.baidu.com')
data = htmlpage.readlines()
print data

希望本文所述对大家的Python程序设计有所帮助。

相关文章

如何使用php判断服务器是否是HTTPS连接

复制代码 代码如下:if ($_SERVER['HTTPS'] != "on") { echo "This is not HTTPS";}else{ echo "Th...

同台服务器使用缓存APC效率高于Memcached的演示代码

复制代码 代码如下:<?php $memcachehost = 'localhost'; $memcacheport = '11211'; function microtime_f...

Python中使用Flask、MongoDB搭建简易图片服务器

1、前期准备 通过 pip 或 easy_install 安装了 pymongo 之后, 就能通过 Python 调教 mongodb 了. 接着安装个 flask 用来当 web 服务...

单台服务器的PHP进程之间实现共享内存的方法

开发人员要想使php进程实现共享内存的读写,首先就要支持IPC函数,即php编译安装时指定:--enable-shmop  与--enable-sysvsem 两个选项。 IP...

python探索之BaseHTTPServer-实现Web服务器介绍

在Python探索之SocketServer详解中我们介绍了Python标准库中的SocketServer模块,了解了要实现网络通信服务,就要构建一个服务器类和请求处理类。同时,该模块还...