예제 #1
0
파일: api.py 프로젝트: weinix/apim_pyclient
 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']]
예제 #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())
예제 #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))
예제 #4
0
파일: api.py 프로젝트: weinix/apim_pyclient
 def set_rest_client(self, client=RestClient()):
     self.client = client
예제 #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")
예제 #6
0
 def set_rest_client(self, client=RestClient(APPLICATION)):
     self.client = client