import requests
class Singleton(object):
@classmethod
def get_instance(cls, input):
if not hasattr(cls, "_instance"):
cls._instance = cls(input)
return cls._instance
class Session(Singleton):
def __init__(self):
self.session = requests.Session()
session = Session()
session.session.get("https://google.com")
参考