Compare commits
3 Commits
a7178b6f86
...
f05ffdd86d
Author | SHA1 | Date | |
---|---|---|---|
f05ffdd86d | |||
ddb5194320 | |||
003b2ff367 |
@ -37,6 +37,15 @@ r = c.connection.request(m)
|
|||||||
|
|
||||||
Consult class documentation for more in depth examples and options.
|
Consult class documentation for more in depth examples and options.
|
||||||
|
|
||||||
|
## Interactive CLI
|
||||||
|
|
||||||
|
The package installs a script called `ommclient2`.
|
||||||
|
This allowes basic interactive testing of the library.
|
||||||
|
|
||||||
|
```
|
||||||
|
ommclient2 --help
|
||||||
|
```
|
||||||
|
|
||||||
## Attribution
|
## Attribution
|
||||||
|
|
||||||
This software is inspired by `python-mitel` by Thomas and n-st.
|
This software is inspired by `python-mitel` by Thomas and n-st.
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
from mitel_ommclient2 import OMMClient2
|
|
||||||
from mitel_ommclient2.exceptions import ENoEnt
|
|
||||||
from mitel_ommclient2.messages import GetAccount, Ping
|
|
||||||
import time
|
|
||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
import getpass
|
import getpass
|
||||||
|
import time
|
||||||
import traceback
|
import traceback
|
||||||
|
|
||||||
|
from . import OMMClient2
|
||||||
|
from .exceptions import ENoEnt
|
||||||
|
from .messages import GetAccount, Ping
|
||||||
|
|
||||||
# exit handling with argparse is a bit broken even with exit_on_error=False, so we hack this
|
# exit handling with argparse is a bit broken even with exit_on_error=False, so we hack this
|
||||||
def error_instead_exit(self, message):
|
def error_instead_exit(self, message):
|
||||||
raise argparse.ArgumentError(None, message)
|
raise argparse.ArgumentError(None, message)
|
||||||
@ -22,8 +22,7 @@ def format_list(v):
|
|||||||
|
|
||||||
return fl
|
return fl
|
||||||
|
|
||||||
if __name__ == "__main__":
|
def main():
|
||||||
|
|
||||||
connect_parser = argparse.ArgumentParser(prog='ommclient2')
|
connect_parser = argparse.ArgumentParser(prog='ommclient2')
|
||||||
connect_parser.add_argument("-n", dest="hostname", default="127.0.0.1")
|
connect_parser.add_argument("-n", dest="hostname", default="127.0.0.1")
|
||||||
connect_parser.add_argument("-u", dest="username", default="omm")
|
connect_parser.add_argument("-u", dest="username", default="omm")
|
||||||
@ -178,3 +177,6 @@ if __name__ == "__main__":
|
|||||||
print("".join(traceback.format_exception(type(e), e, e.__traceback__)))
|
print("".join(traceback.format_exception(type(e), e, e.__traceback__)))
|
||||||
continue
|
continue
|
||||||
print(format(r))
|
print(format(r))
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
@ -23,5 +23,8 @@ crypt = [
|
|||||||
"rsa",
|
"rsa",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[project.scripts]
|
||||||
|
ommclient2 = "mitel_ommclient2.cli:main"
|
||||||
|
|
||||||
[project.urls]
|
[project.urls]
|
||||||
"Source" = "https://git.clerie.de/clerie/mitel_ommclient2"
|
"Source" = "https://git.clerie.de/clerie/mitel_ommclient2"
|
||||||
|
Loading…
Reference in New Issue
Block a user