Skip to content
Branch: master
Find file Copy path
Find file Copy path
4 contributors

Users who have contributed to this file

@arikfr @washort @rauchy @jeffwidman
46 lines (31 sloc) 1.11 KB
from redash.query_runner import BaseHTTPQueryRunner, register
from redash.utils import deprecated
class Url(BaseHTTPQueryRunner):
requires_url = False
def annotate_query(cls):
return False
def test_connection(self):
def run_query(self, query, user):
base_url = self.configuration.get("url", None)
query = query.strip()
if base_url is not None and base_url != "":
if query.find("://") > -1:
return None, "Accepting only relative URLs to '%s'" % base_url
if base_url is None:
base_url = ""
url = base_url + query
response, error = self.get_response(url)
if error is not None:
return None, error
json_data = response.content.strip()
if json_data:
return json_data, None
return None, "Got empty response from '{}'.".format(url)
except KeyboardInterrupt:
return None, "Query cancelled by user."
You can’t perform that action at this time.