注册 登录
编程论坛 Python论坛

有没有人用过requests代理访问外网尼,怎么我的访问不了啊

PSWFY 发布于 2016-11-02 16:57, 2293 次点击
#encoding=utf8
import requests
import sys
from bs4 import BeautifulSoup
reload(sys)
sys.setdefaultencoding('utf-8')
type = sys.getfilesystemencoding()
proxie = {
    'http' : '149.56.206.48:8080'}
url = 'https://'
header = {
    'User-Agent' : 'Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.76 Mobile Safari/537.36',
    }

s = requests.session()
response = s.get(url,headers = header,proxies = proxie,verify=False)
#print response.text
f = open('FC.txt','w')
f.write(response.content)
f.close()
0 回复
1