From commits-return-1000-archive-asf-public=cust-asf.ponee.io@superset.incubator.apache.org Wed May 16 23:38:09 2018 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id D2823180671 for ; Wed, 16 May 2018 23:38:08 +0200 (CEST) Received: (qmail 24851 invoked by uid 500); 16 May 2018 21:38:08 -0000 Mailing-List: contact commits-help@superset.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@superset.incubator.apache.org Delivered-To: mailing list commits@superset.incubator.apache.org Received: (qmail 24842 invoked by uid 99); 16 May 2018 21:38:07 -0000 Received: from ec2-52-202-80-70.compute-1.amazonaws.com (HELO gitbox.apache.org) (52.202.80.70) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 16 May 2018 21:38:07 +0000 Received: by gitbox.apache.org (ASF Mail Server at gitbox.apache.org, from userid 33) id 3532D80B29; Wed, 16 May 2018 21:38:07 +0000 (UTC) Date: Wed, 16 May 2018 21:38:07 +0000 To: "commits@superset.apache.org" Subject: [incubator-superset] branch master updated: Make port number optional in superset for druid (#5020) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Message-ID: <152650668703.20551.11447057209703974377@gitbox.apache.org> From: hugh@apache.org X-Git-Host: gitbox.apache.org X-Git-Repo: incubator-superset X-Git-Refname: refs/heads/master X-Git-Reftype: branch X-Git-Oldrev: e72c9cded37f7e1b6eaf3c5192249f5d08ce5ce4 X-Git-Newrev: 2bf53dad9892fb2fa7b8f634cdd7e4381cd1696a X-Git-Rev: 2bf53dad9892fb2fa7b8f634cdd7e4381cd1696a X-Git-NotificationType: ref_changed_plus_diff X-Git-Multimail-Version: 1.5.dev Auto-Submitted: auto-generated 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 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.