31 lines
624 B
Python
31 lines
624 B
Python
|
|
from config_manager.config_manager import ConfigManager
|
|
import asyncio
|
|
import logging
|
|
|
|
import os
|
|
os.chdir(os.path.dirname(__file__))
|
|
|
|
logger = logging.getLogger()
|
|
|
|
class MailOrderBot(ConfigManager):
|
|
def __init__(self, *agrs, **kwargs):
|
|
super().__init__(*agrs, **kwargs)
|
|
|
|
def execute(self):
|
|
print("run")
|
|
|
|
|
|
async def main():
|
|
app = MailOrderBot("config.yaml") # Можно config.json или config.yaml
|
|
task = asyncio.create_task(app.start())
|
|
await asyncio.sleep(5)
|
|
app.stop()
|
|
await task
|
|
logger.info("Work finished.")
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
asyncio.run(main())
|
|
|