blob: 2a5a9a8632664002a3ea37e574c7b37e0e89ae09 [file] [log] [blame]
#!/bin/env python
import requests
class BMC:
def __init__(self, server):
self.url = "https://{0}/".format(server)
self.session = requests.Session()
self.login()
def login(self):
r = self.session.post(self.url + 'login',
json={ 'data': [ 'root', '0penBmc']},
verify=False)
j = r.json()
if j['status'] != 'ok':
raise Exception("Failed to login: \n" + r.text)
def list_events(self):
r = self.session.get(self.url + 'xyz/openbmc_project/logging/entry/',
verify=False)
j = r.json()
if j['status'] != 'ok':
raise Exception("Failed to query entries: \n" + r.text)
events = j['data']
events.sort(key=lambda x: int(x.split("/")[-1]))
return events
s = BMC(server="w50.aus.stglabs.ibm.com")
for e in s.list_events():
print(e)