Esempio n. 1
0
 def all(client=RestClient()):
     res = client.session.get(API.get_endpoint(), verify=client.verify)
     if not res.status_code == 200:
         print(res.json())
         raise Exception("Error getting APIs list")
     print("Status code: {}".format(res.status_code))
     return [API(**api) for api in res.json()['list']]
Esempio n. 2
0
 def get(cls, resource_id, client=RestClient()):
     res = client.session.get(cls.get_endpoint() +
                              "/{}".format(resource_id),
                              verify=client.verify)
     if res.status_code != 200:
         print("Warning Error while getting the Resource {}\nERROR: {}".
               format(resource_id, res.content))
     print("Status code: {}".format(res.status_code))
     return cls(**res.json())
Esempio n. 3
0
 def delete_all(client=RestClient()):
     res = client.session.get(Application.get_endpoint(), verify=client.verify)
     if not res.status_code == 200:
         print(res.json())
         raise Exception("Error getting Applications list")
     print("Status code: {}".format(res.status_code))
     apps_list = res.json()['list']
     for app in apps_list:
         res = client.session.delete(Application.get_endpoint() + "/{}".format(app['applicationId']), verify=client.verify)
         if res.status_code != 200:
             print("Warning Error while deleting the API {}\nERROR: {}".format(app['name'], res.content))
         print("Status code: {}".format(res.status_code))
Esempio n. 4
0
 def set_rest_client(self, client=RestClient()):
     self.client = client
Esempio n. 5
0
 def __init__(self, debug=True):
     self.debub = debug
     self.client = RestClient()
     # TODO: Move this to map to make it extensible
     self.store_client = RestClient("store")
Esempio n. 6
0
 def set_rest_client(self, client=RestClient(APPLICATION)):
     self.client = client