superset-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From h...@apache.org
Subject [incubator-superset] branch master updated: Make port number optional in superset for druid (#5020)
Date Wed, 16 May 2018 21:38:07 GMT
This is an automated email from the ASF dual-hosted git repository.

hugh pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-superset.git


The following commit(s) were added to refs/heads/master by this push:
     new 2bf53da  Make port number optional in superset for druid (#5020)
2bf53da is described below

commit 2bf53dad9892fb2fa7b8f634cdd7e4381cd1696a
Author: Arup Malakar <amalakar@gmail.com>
AuthorDate: Wed May 16 14:38:00 2018 -0700

    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
---
 superset/connectors/druid/models.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/superset/connectors/druid/models.py b/superset/connectors/druid/models.py
index 3cece6e..85afc85 100644
--- a/superset/connectors/druid/models.py
+++ b/superset/connectors/druid/models.py
@@ -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(

-- 
To stop receiving notification emails like this one, please contact
hugh@apache.org.

Mime
View raw message