--credentials required
This commit is contained in:
parent
e1790932f3
commit
e3d25bbdb8
1 changed files with 13 additions and 2 deletions
|
@ -1,5 +1,7 @@
|
|||
import asyncio
|
||||
import logging
|
||||
import pathlib
|
||||
from typing import Tuple
|
||||
|
||||
from panoramisk import Manager
|
||||
|
||||
|
@ -12,6 +14,7 @@ def add_arguments(p):
|
|||
default="INFO",
|
||||
choices=["DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL"],
|
||||
)
|
||||
p.add_argument("--credentials", type=pathlib.Path, required=True)
|
||||
return p
|
||||
|
||||
|
||||
|
@ -20,15 +23,23 @@ def do_common_options(args):
|
|||
logging.getLogger("panoramisk.manager").setLevel(logging.WARNING)
|
||||
|
||||
|
||||
def read_credentials(fpath) -> Tuple[str, str]:
|
||||
with fpath.open() as buf:
|
||||
username = buf.readline().rstrip("\n\r")
|
||||
password = buf.readline().rstrip("\n\r")
|
||||
return username, password
|
||||
|
||||
|
||||
def get_manager(args):
|
||||
username, password = read_credentials(args.credentials)
|
||||
manager = Manager(
|
||||
loop=LOOP,
|
||||
host="127.0.0.1",
|
||||
port=5038,
|
||||
ssl=False,
|
||||
encoding="utf8",
|
||||
username="ring",
|
||||
secret="campanellino",
|
||||
username=username,
|
||||
secret=password,
|
||||
ping_delay=10, # Delay after start
|
||||
ping_interval=10, # Periodically ping AMI (dead or alive)
|
||||
reconnect_timeout=2, # Timeout reconnect if connection lost
|
||||
|
|
Loading…
Reference in a new issue