import os import sys import asyncio import threading from sqlalchemy import create_engine from instagrapi import Client # from dotenv import load_dotenv from ig import IG from db import dbhelper from db.pgclass import Base from grpcServer import grpcServer, anoth from utils.const import DEBUG # load_dotenv() if DEBUG: print("[*] ===== DEBUG MODE =====") # Database PG_HOST = os.environ.get("PG_HOST", None).strip() print("[*] Connecting to Database") dbhelper.db = dbhelper.DB(create_engine(PG_HOST)) Base.metadata.create_all(dbhelper.db._engine) # IG Login IG.init(Client()) if not DEBUG and not IG.login(): sys.exit(0) # run grpc if __name__ == "__main__": # upload / delete processor threading.Thread(target=anoth.run).start() # grpc main asyncio.get_event_loop().run_until_complete(grpcServer.serve())