# encoding:utf-8
import ssl
from requests import sessions
from requests import Request
from requests.adapters import HTTPAdapter
from requests.packages.urllib3.poolmanager import PoolManager
class Ssl3HttpAdapter(HTTPAdapter):
def __int__(self):
super(HTTPAdapter, self).__init__()
def init_poolmanager(self, connections, maxsize, block=False):
self.poolmanager = PoolManager(
num_pools=connections,
maxsize=maxsize,
block=block,
strict=True,
ssl_version=ssl.PROTOCOL_SSLv3
)
adapter = Ssl3HttpAdapter()
s = sessions.Session()
s.mount("http://172",adapter=adapter)
r = Request(‘GET‘, ‘http://172.21.2.3:8009/ad09‘)
p = r.prepare()
# resp=s.request(‘GET‘, ‘http://172.21.2.3:8009/ad09‘)
resp = s.send(p)
print resp.status_code
原文地址:https://www.cnblogs.com/tnyleyon/p/9452842.html