niming_igapi/utils/shareclass.py

19 lines
442 B
Python
Raw Normal View History

2024-11-22 02:14:01 +08:00
from sqlalchemy.orm import sessionmaker
class Shared:
_client = None # For instagram
_engine = None # For engine
@classmethod
def __init__(cls, cl, eng):
cls._client = cl
cls._engine = eng
@classmethod
def ig_get_client(cls):
return cls._client
@classmethod
def db_get_session(cls):
Session = sessionmaker(bind=cls._engine)
return Session()