Esempio n. 1
0
        def patch_get_item(self, item):
            if item.startswith("__"):
                # make client can be pickled
                raise AttributeError()

            method = item.upper()
            if method not in self.allowed_methods:
                raise MethodError("esb api does not support method: %s" % method)
            self.method = method
            return self
Esempio n. 2
0
 def __getattr__(self, method):
     method = method.upper()
     if method not in self.allowed_methods:
         raise MethodError("esb api does not support method: %s" % method)
     api_cls = self.collection.client.load_sdk_class("base", "ComponentAPI")
     return api_cls(client=SDKClient(**self.collection.client.common_args),
                    method=method,
                    path='{api_prefix}{collection}/{action}/'.format(
                        api_prefix=ESB_API_PREFIX,
                        collection=self.collection.client.mod_name,
                        action=self.action),
                    description='custom api(%s)' % self.action)