Skip to content

Instantly share code, notes, and snippets.

@Millnert
Last active September 12, 2016 20:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Millnert/5294ae0e0efc9d574509f04a652afe64 to your computer and use it in GitHub Desktop.
Save Millnert/5294ae0e0efc9d574509f04a652afe64 to your computer and use it in GitHub Desktop.
debug of openstacksdks 0.9.5 _get_endpoint_version
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='')
@Millnert
Copy link
Author

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='')

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment