Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
data = {'query': rewritten_query}
glogger.debug('Sending HTTP request to SPARQL endpoint with params: {}'.format(data))
glogger.debug('Sending HTTP request to SPARQL endpoint with headers: {}'.format(reqHeaders))
glogger.debug('Sending HTTP request to SPARQL endpoint with auth: {}'.format(auth))
response = requests.get(endpoint, params=data, headers=reqHeaders, auth=auth)
glogger.debug('Response header from endpoint: ' + response.headers['Content-Type'])
# Response headers
resp = response.text
headers['Content-Type'] = response.headers['Content-Type']
# If the query is paginated, set link HTTP headers
if pagination:
# Get number of total results
count = gquery.count_query_results(rewritten_query, endpoint)
pageArg = requestArgs.get('page', None)
headerLink = pageUtils.buildPaginationHeader(count, pagination, pageArg, requestUrl)
headers['Link'] = headerLink
if 'proto' in query_metadata: # sparql transformer
resp = SPARQLTransformer.post_process(json.loads(resp), query_metadata['proto'], query_metadata['opt'])
headers['Server'] = 'grlc/' + grlc_version
return resp, 200, headers