使用 pycurl 和端口号检索 url 的源代码?

Retrieve the source code of a url using pycurl and a port number?

是否有任何方法可以检索 url 源代码并将其存储在字符串中,前提是在 pycurl 模块中定义了特定端口以便它适用于代理网络。 平台 - ubuntu 或任何其他 linux 发行版

使用此代码获取 url

的源代码
from StringIO import StringIO    
import pycurl

url = 'http://www.google.com/'

storage = StringIO()
c = pycurl.Curl()
c.setopt(c.URL, url)
c.setopt(c.WRITEFUNCTION, storage.write)
c.perform()
c.close()
content = storage.getvalue()
print content