From: peusterm Date: Wed, 30 Aug 2017 07:22:37 +0000 (+0200) Subject: added helper lib X-Git-Tag: v3.1~13^2~2 X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=c62be48ec66570a0aba61cd680a37698d1e2626a;p=osm%2Fvim-emu.git added helper lib --- diff --git a/src/emuvim/api/openstack/helper.py b/src/emuvim/api/openstack/helper.py new file mode 100644 index 0000000..dca3ba5 --- /dev/null +++ b/src/emuvim/api/openstack/helper.py @@ -0,0 +1,11 @@ +from urlparse import urlparse +import logging + +LOG = logging.getLogger("api.openstack.helper") + +def get_host(r): + try: + return urlparse(r.base_url).hostname + except: + LOG.error("Could not get host part of request URL.") + return "0.0.0.0"