Make port number optional in superset for druid (#5020)
* Make port number optional in superset for druid
It appears that urllib throws error with ssl if port number is provided
```
url = "https://example.com:443/druid/v2"
req = urllib.request.Request(url, druid_query_str, headers)
res = urllib.request.urlopen(req)
```
The above call fails with the following error:
```
urllib2.HTTPError: HTTP Error 404: Not Found
```
If url is set to https://example.com/druid/v2 it works, this change
makes the port number optional.
* Rewrite if/else in concisely python way
This commit is contained in:
parent
e72c9cded3
commit
2bf53dad98
|
|
@ -116,7 +116,9 @@ class DruidCluster(Model, AuditMixinNullable, ImportMixin):
|
|||
def get_base_url(host, port):
|
||||
if not re.match('http(s)?://', host):
|
||||
host = 'http://' + host
|
||||
return '{0}:{1}'.format(host, port)
|
||||
|
||||
url = '{0}:{1}'.format(host, port) if port else host
|
||||
return url
|
||||
|
||||
def get_base_coordinator_url(self):
|
||||
base_url = self.get_base_url(
|
||||
|
|
|
|||
Loading…
Reference in New Issue