1f6eac7c3d
In the fold_headers function, if the headers behaves like a dict, they were being retured unchanged. This would cause issues in the later processing to extract the microversion header, which matches on lower case strings. Convert these headers to lowercase also provide a test case to validate the header is being parsed correctly. Change-Id: I8501c813d668c0a32905906e4ef3f8c6c6b12de2 Close-Bug:# 1606351 |
||
---|---|---|
doc/source | ||
microversion_parse | ||
.gitignore | ||
.gitreview | ||
.testr.conf | ||
LICENSE | ||
Makefile | ||
README.rst | ||
requirements.txt | ||
setup.cfg | ||
setup.py | ||
test-requirements.txt | ||
tox.ini |
README.rst
microversion_parse
A simple parser for OpenStack microversion headers:
import microversion_parse
# headers is a dict of headers with folded (comma-separated
# values) or a list of header, value tuples
version = microversion_parse.get_version(
headers, service_type='compute',
legacy_headers=['x-openstack-nova-api-version'])
It processes microversion headers with the standard form:
OpenStack-API-Version: compute 2.1
If provided with a legacy_headers
argument, this is
treated as a list of headers to check for microversions. Some examples
of headers include:
OpenStack-telemetry-api-version: 2.1
OpenStack-nova-api-version: 2.1
X-OpenStack-nova-api-version: 2.1
If a version string cannot be found, None
will be
returned. If the input is incorrect usual Python exceptions (ValueError,
TypeError) are allowed to raise to the caller.