示例#1
0
    def load_spec(self, spec_url, base_url=None):
        """Load a Swagger Spec from the given URL

        :param spec_url: URL to swagger.json
        :param base_url: TODO: need this?
        :returns: json spec in dict form
        """
        response = request(
            self.http_client,
            spec_url,
            self.request_headers,
        ).result()

        content_type = response.headers.get('content-type', '').lower()
        if is_yaml(spec_url, content_type):
            return self.load_yaml(response.text)
        else:
            return response.json()
示例#2
0
    def load_spec(self, spec_url, base_url=None):
        """Load a Swagger Spec from the given URL

        :param spec_url: URL to swagger.json
        :param base_url: TODO: need this?
        :returns: json spec in dict form
        """
        response = request(
            self.http_client,
            spec_url,
            self.request_headers,
        ).result()

        content_type = response.headers.get('content-type', '').lower()
        if is_yaml(spec_url, content_type):
            return self.load_yaml(response.text)
        else:
            return response.json()
示例#3
0
 def __init__(self, path):
     self.path = path
     self.is_yaml = is_yaml(path)
示例#4
0
 def __init__(self, path):
     self.path = path
     self.is_yaml = is_yaml(path)