Last active
September 12, 2016 20:09
-
-
Save Millnert/5294ae0e0efc9d574509f04a652afe64 to your computer and use it in GitHub Desktop.
debug of openstacksdks 0.9.5 _get_endpoint_version
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
endpoint = 'https://nova.api.cloud.ipnett.se/v2/<some_tenant_uuid>' | |
parts = parse.urlparse(endpoint) | |
if ':' in parts.netloc: | |
root_endpoint = "://".join([parts.scheme, parts.netloc]) | |
else: | |
root_endpoint = endpoint | |
print root_endpoint | |
# Example | |
endpoint='https://nova.api.cloud.ipnett.se/v2/<some_tenant_uuid>' | |
parse.urlparse(endpoint) | |
ParseResult(scheme='https', netloc='nova.api.cloud.ipnett.se', path='/v2/<some_tenant_uuid>', params='', query='', fragment='') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In [11]: endpoint='https://nova.api.cloud.ipnett.se/v2/<some_tenant_uuid>'
In [15]: parse.urlparse(endpoint)
Out[15]: ParseResult(scheme='https', netloc='nova.api.cloud.ipnett.se', path='/v2/<some_tenant_uuid>', params='', query='', fragment='')