-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Roman Pertsev
committed
Oct 12, 2023
1 parent
0bac521
commit d794329
Showing
1 changed file
with
27 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import logging | ||
import os | ||
|
||
from panoramisk import Manager, Message | ||
|
||
|
||
manager = Manager( | ||
host=os.getenv('AMI_HOST', '127.0.0.1'), | ||
port=os.getenv('AMI_PORT', 5038), | ||
username=os.getenv('AMI_USERNAME', 'username'), | ||
secret=os.getenv('AMI_SECRET', 'mysecret'), | ||
auth_type='md5', # MD5 auth, no case sensitive | ||
ping_delay=10, # Delay after start | ||
ping_interval=10, # Periodically ping AMI (dead or alive) | ||
reconnect_timeout=2, # Timeout reconnect if connection lost | ||
) | ||
|
||
|
||
@manager.register_event('*') # Register all events | ||
async def ami_callback(mngr: Manager, msg: Message): | ||
if msg.Event == 'FullyBooted': | ||
print(msg) | ||
|
||
|
||
if __name__ == '__main__': | ||
logging.basicConfig(level=logging.INFO) | ||
manager.connect(run_forever=True) |