def get(self): specs = [] for module in iter_entry_points(group=self.api_entry_point): try: plugin_package = module.module_name.rsplit('.', 1)[0] spec = yaml.safe_load( resource_string(plugin_package, self.api_filename)) if not spec: logger.debug('plugin has no API spec: %s', plugin_package) else: specs.append(spec) except ImportError: logger.debug('failed to import %s', plugin_package) except IOError: logger.debug('API spec for module "%s" does not exist', module.module_name) except IndexError: logger.debug('Could not find API spec from module "%s"', module.module_name) except NotImplementedError: logger.debug( 'Are you sure you have an __init__ file in your module "%s"?', module.module_name, ) api_spec = ChainMap(*specs) if not api_spec.get('info'): return {'error': "API spec does not exist"}, 404 reverse_proxy_fix_api_spec(api_spec) return make_response(yaml.dump(dict(api_spec)), 200, {'Content-Type': 'application/x-yaml'})
def get(self): try: api_spec = yaml.load(resource_string(self.api_package, self.api_filename)) except IOError: return {'error': "API spec does not exist"}, 404 reverse_proxy_fix_api_spec(api_spec) response = yaml.dump(dict(api_spec)) return make_response(response, 200, {'Content-Type': 'application/x-yaml'})
def get(self): api_spec = ChainMap( *load_all_api_specs('wazo_chatd.plugins', self.api_filename)) if not api_spec.get('info'): return {'error': "API spec does not exist"}, 404 reverse_proxy_fix_api_spec(api_spec) return make_response(yaml.dump(dict(api_spec)), 200, {'Content-Type': 'application/x-yaml'})
def get(self): http_specs = load_all_api_specs('wazo_auth.http', self.api_filename) external_auth_specs = load_all_api_specs( 'wazo_auth.external_auth', self.api_filename ) specs = chain(http_specs, external_auth_specs) api_spec = ChainMap(*specs) if not api_spec.get('info'): return {'error': "API spec does not exist"}, 404 reverse_proxy_fix_api_spec(api_spec) return make_response( yaml.dump(dict(api_spec)), 200, {'Content-Type': 'application/x-yaml'} )