From 514cde035fafa9c679c6cf615cef75dce924ceda Mon Sep 17 00:00:00 2001 From: Carlos Martinez Date: Mon, 26 Jul 2021 23:26:29 +0200 Subject: [PATCH 1/3] Change warnings into debug messages. See #350 --- src/gquery.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/gquery.py b/src/gquery.py index b7d91ec..53aa63c 100644 --- a/src/gquery.py +++ b/src/gquery.py @@ -37,7 +37,7 @@ def guess_endpoint_uri(rq, loader): if has_request_context() and "endpoint" in request.args: endpoint = request.args['endpoint'] - glogger.info("Endpoint provided in request: " + endpoint) + glogger.debug("Endpoint provided in request: " + endpoint) return endpoint, auth # Decorator @@ -45,14 +45,14 @@ def guess_endpoint_uri(rq, loader): decorators = get_yaml_decorators(rq) endpoint = decorators['endpoint'] auth = None - glogger.info("Decorator guessed endpoint: " + endpoint) + glogger.debug("Decorator guessed endpoint: " + endpoint) except (TypeError, KeyError): # File try: endpoint_content = loader.getEndpointText() endpoint = endpoint_content.strip().splitlines()[0] auth = None - glogger.info("File guessed endpoint: " + endpoint) + glogger.debug("File guessed endpoint: " + endpoint) # TODO: except all is really ugly except: # Default @@ -60,7 +60,7 @@ def guess_endpoint_uri(rq, loader): auth = (static.DEFAULT_ENDPOINT_USER, static.DEFAULT_ENDPOINT_PASSWORD) if auth == ('none', 'none'): auth = None - glogger.warning("No endpoint specified, using default ({})".format(endpoint)) + glogger.debug("No endpoint specified, using default ({})".format(endpoint)) return endpoint, auth @@ -175,7 +175,7 @@ def get_parameters(rq, variables, endpoint, query_metadata, auth=None): if vdefault is not None: parameters[vname]['default'] = vdefault - glogger.info('Finished parsing the following parameters: {}'.format(parameters)) + glogger.debug('Finished parsing the following parameters: {}'.format(parameters)) return parameters @@ -213,7 +213,7 @@ def get_enumeration_sparql(rq, v, endpoint, auth=None): """ Returns a list of enumerated values for variable 'v' in query 'rq' """ - glogger.info('Retrieving enumeration for variable {}'.format(v)) + glogger.debug('Retrieving enumeration for variable {}'.format(v)) vcodes = [] # tpattern_matcher = re.compile(".*(FROM\s+)?(?P.*)\s+WHERE.*[\.\{][\n\t\s]*(?P.*\?" + re.escape(v) + ".*?\.).*", flags=re.DOTALL) # tpattern_matcher = re.compile(".*?((FROM\s*)(?P(\<.*\>)+))?\s*WHERE\s*\{(?P.*)\}.*", flags=re.DOTALL) @@ -346,9 +346,9 @@ def get_metadata(rq, endpoint): try: # update query - glogger.info("Trying to parse UPDATE query") + glogger.debug("Trying to parse UPDATE query") parsed_query = UpdateUnit.parseString(rq, parseAll=True) - glogger.info(parsed_query) + glogger.debug(parsed_query) query_metadata['type'] = parsed_query[0]['request'][0].name if query_metadata['type'] == 'InsertData': query_metadata['parameters'] = { @@ -357,7 +357,7 @@ def get_metadata(rq, endpoint): 'data': {'datatype': None, 'enum': [], 'lang': None, 'name': 'data', 'original': '?_data', 'required': True, 'type': 'literal'}} - glogger.info("Update query parsed with {}".format(query_metadata['type'])) + glogger.debug("Update query parsed with {}".format(query_metadata['type'])) # if query_metadata['type'] == 'InsertData': # query_metadata['variables'] = parsed_query.algebra['PV'] except: @@ -378,7 +378,7 @@ def paginate_query(query, results_per_page, get_args): split display a maximum of `results_per_page`.""" page = get_args.get('page', 1) - glogger.info("Paginating query for page {}, {} results per page".format(page, results_per_page)) + glogger.debug("Paginating query for page {}, {} results per page".format(page, results_per_page)) # If contains LIMIT or OFFSET, remove them glogger.debug("Original query: " + query) From 6c2cf0a7235e1f0a3ca88b712efdd394b64d1177 Mon Sep 17 00:00:00 2001 From: Carlos Martinez Date: Wed, 4 Aug 2021 19:25:22 +0200 Subject: [PATCH 2/3] Update debug to info message --- src/gquery.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gquery.py b/src/gquery.py index 53aa63c..9278941 100644 --- a/src/gquery.py +++ b/src/gquery.py @@ -60,7 +60,7 @@ def guess_endpoint_uri(rq, loader): auth = (static.DEFAULT_ENDPOINT_USER, static.DEFAULT_ENDPOINT_PASSWORD) if auth == ('none', 'none'): auth = None - glogger.debug("No endpoint specified, using default ({})".format(endpoint)) + glogger.info("No endpoint specified, using default ({})".format(endpoint)) return endpoint, auth From cd1f37de2b12503f4666272101f50e321041882d Mon Sep 17 00:00:00 2001 From: Carlos Martinez Date: Thu, 23 Sep 2021 21:52:31 +0200 Subject: [PATCH 3/3] Add extra debug message --- src/utils.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/utils.py b/src/utils.py index 15fc21a..4f8ed7d 100644 --- a/src/utils.py +++ b/src/utils.py @@ -208,6 +208,8 @@ def dispatchSPARQLQuery(raw_sparql_query, loader, requestArgs, acceptHeader, con # Response headers resp = response.text + + glogger.debug('Got HTTP response from to SPARQL endpoint: {}'.format(resp)) headers['Content-Type'] = response.headers['Content-Type'] # If the query is paginated, set link HTTP headers