From c62be48ec66570a0aba61cd680a37698d1e2626a Mon Sep 17 00:00:00 2001 From: peusterm Date: Wed, 30 Aug 2017 09:22:37 +0200 Subject: [PATCH] added helper lib --- src/emuvim/api/openstack/helper.py | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 src/emuvim/api/openstack/helper.py 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" -- 2.25.1