added helper lib
authorpeusterm <manuel.peuster@uni-paderborn.de>
Wed, 30 Aug 2017 07:22:37 +0000 (09:22 +0200)
committerpeusterm <manuel.peuster@uni-paderborn.de>
Wed, 30 Aug 2017 07:22:37 +0000 (09:22 +0200)
src/emuvim/api/openstack/helper.py [new file with mode: 0644]

diff --git a/src/emuvim/api/openstack/helper.py b/src/emuvim/api/openstack/helper.py
new file mode 100644 (file)
index 0000000..dca3ba5
--- /dev/null
@@ -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"