| peusterm | c62be48 | 2017-08-30 09:22:37 +0200 | [diff] [blame] | 1 | from urlparse import urlparse |
| 2 | import logging | ||||
| 3 | |||||
| 4 | LOG = logging.getLogger("api.openstack.helper") | ||||
| 5 | |||||
| 6 | def get_host(r): | ||||
| 7 | try: | ||||
| 8 | return urlparse(r.base_url).hostname | ||||
| 9 | except: | ||||
| 10 | LOG.error("Could not get host part of request URL.") | ||||
| 11 | return "0.0.0.0" | ||||