diff options
author | Roberto Hueso Gómez <rhueso@soleta.eu> | 2020-06-30 12:51:51 +0200 |
---|---|---|
committer | Roberto Hueso Gómez <rhueso@soleta.eu> | 2020-06-30 12:51:51 +0200 |
commit | dbf0f00650200b8b4817274953f2e0b684bd622d (patch) | |
tree | 1bf085f2502e9704a7e1bf46cfc44aa039da5292 /ogcli/ogcli.py | |
parent | f41b5f8f9dd5672864b2dfe995e73f259741fa8b (diff) |
Rename files to remove 'og' prefix
This prefix is redundant on almost every file, so the prefix is removed from
filenames and imports.
Diffstat (limited to 'ogcli/ogcli.py')
-rw-r--r-- | ogcli/ogcli.py | 39 |
1 files changed, 0 insertions, 39 deletions
diff --git a/ogcli/ogcli.py b/ogcli/ogcli.py deleted file mode 100644 index d8e66b7..0000000 --- a/ogcli/ogcli.py +++ /dev/null @@ -1,39 +0,0 @@ -from ogcli.objects.og_client import OgClient -from ogcli.objects.og_scopes import OgScope -from ogcli.objects.modes import OgModes -import argparse -import requests -import sys - -class OgREST(): - def __init__(self, ip, port, api_token): - self.URL = f'http://{ip}:{port}' - self.HEADERS = {'Authorization' : api_token} - - def get(self, path): - try: - r = requests.get(f'{self.URL}{path}', - headers=self.HEADERS) - if r.status_code != 200: - sys.exit(f"Cannot connect to ogServer: " - f"{r.status_code} HTTP status code") - except IOError as e: - sys.exit(f"Cannot connect to ogServer: {e}") - return r - -class OgCLI(): - def __init__(self, cfg): - self.rest = OgREST(cfg['ip'], cfg['port'], cfg['api_token']) - - def list(self, args): - choices = ['clients', 'scopes', 'modes'] - parser = argparse.ArgumentParser() - parser.add_argument('item', choices=choices) - args = parser.parse_args(args) - - if args.item == 'clients': - OgClient.list_clients(self.rest) - elif args.item == 'modes': - OgModes.list_available_modes(self.rest) - elif args.item == 'scopes': - OgScope.list_scopes(self.rest) |