cdxing In solitude, where we are least alone

python 爬虫代理

示例代码:<python3>

import urllib.request
import random

url = "http://www.cnblogs.com/cdxing"
 
 
proxy_handler = urllib.request.ProxyHandler({
    'https': 'http://211.155.234.99:80',
    'https': 'http://218.75.100.114:8080'
})
opener = urllib.request.build_opener(proxy_handler)
response = opener.open(url)
print(response.read().decode('utf-8'))

posted @ 2017-07-07 16:14  cdxing  阅读(421)  评论(0)    收藏  举报