(headers, default_version, latest_version)
return version
Determine the API version requested based on the headers supplied.

        :param headers: webob headers
        :param default_version: version to use if not specified in headers
        :param latest_version: version to use if latest is requested
        :returns: a tuple of (major, minor) version numbers
        :raises: webob.HTTPNotAcceptable
Determine the API version requested based on the headers supplied.
Determine the API version requested based on the headers supplied .
def parse_headers(headers, default_version, latest_version):
        """Determine the API version requested based on the headers supplied.

        :param headers: webob headers
        :param default_version: version to use if not specified in headers
        :param latest_version: version to use if latest is requested
        :returns: a tuple of (major, minor) version numbers
        :raises: webob.HTTPNotAcceptable
        """

        version_hdr = headers.get(Version.string, default_version)

        try:
            version_service, version_str = version_hdr.split()
        except ValueError:
            raise exc.HTTPNotAcceptable(_(
                "Invalid service type for %s header") % Version.string)

        if version_str.lower() == 'latest':
            version_service, version_str = latest_version.split()

        if version_service != Version.service_string:
            raise exc.HTTPNotAcceptable(_(
                "Invalid service type for %s header") % Version.string)
        try:
            version = tuple(int(i) for i in version_str.split('.'))
        except ValueError:
            version = ()

        if len(version) != 2:
            raise exc.HTTPNotAcceptable(_(
                "Invalid value for %s header") % Version.string)
        return version
def parse_headers ( headers , default_version , latest_version ) : version_hdr = headers . get ( Version . string , default_version ) try : version_service , version_str = version_hdr . split ( ) except ValueError : raise exc . HTTPNotAcceptable ( _ ( "Invalid service type for %s header" ) % Version . string ) if version_str . lower ( ) == 'latest' : version_service , version_str = latest_version . split ( ) if version_service != Version . service_string : raise exc . HTTPNotAcceptable ( _ ( "Invalid service type for %s header" ) % Version . string ) try : version = tuple ( int ( i ) for i in version_str . split ( '.' ) ) except ValueError : version = ( ) if len ( version ) != 2 : raise exc . HTTPNotAcceptable ( _ ( "Invalid value for %s header" ) % Version . string ) return version