blob: d383e2d9d4e5859646c702d2790c6882d3678289 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
import requests
class OgCLI():
def __init__(self, cfg):
self.api_token = cfg['api_token']
def client_list(self):
headers = {'Authorization' : self.api_token}
try:
r = requests.get('http://127.0.0.1:8888/clients',
headers=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}")
print(r.json())
|