Skip to content

Commit

Permalink
oslcquery now shows the query url using oslc_config.context parameter…
Browse files Browse the repository at this point in the history
… if you use the -V option - although it still uses the Configuration.Context header when making the query
  • Loading branch information
barny committed Jan 17, 2024
1 parent 546e17a commit 33a6659
Show file tree
Hide file tree
Showing 70 changed files with 17,396 additions and 15,635 deletions.
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 0.26.0
current_version = 0.26.2
commit = True
tag = True

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

SPDX-License-Identifier: MIT

version="0.26.0"
version="0.26.2"

What's New?
===========
Expand Down
2 changes: 1 addition & 1 deletion elmclient/__meta__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

app = 'elmoslcquery'
description = 'Commandline OSLC query for ELM'
version = '0.26.0'
version = '0.26.2'
license = 'MIT'
author_name = 'Ian Barnard'
author_mail = 'ian.barnard@uk.ibm.com'
Expand Down
13 changes: 8 additions & 5 deletions elmclient/oslcqueryapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# SPDX-License-Identifier: MIT
##


import copy
import logging
import re
import time
Expand Down Expand Up @@ -338,7 +338,7 @@ def _evaluate_steps(self, querycapabilityuri,querysteps,*,resultstack=None, sele
# raise Exception( f"Very strange parse result! {step}" )
else:
# do an actual query
results = self.execute_oslc_query(querycapabilityuri,whereterms=[step], select=select, prefixes=prefixes, orderbys=orderbys, searchterms=searchterms, show_progress=show_progress, maxresults=maxresults, delaybetweenpages=delaybetweenpages, pagesize=pagesize, verbose=verbose, saverawresults=saverawresults, cacheable=cacheable)
results = self.execute_oslc_query(querycapabilityuri,whereterms=[step], select=select, prefixes=prefixes, orderbys=orderbys, searchterms=searchterms, show_progress=show_progress, maxresults=maxresults, delaybetweenpages=delaybetweenpages, pagesize=pagesize, verbose=verbose, saverawresults=saverawresults, cacheable=cacheable, intent="Perform OSLC Query")
if isinstance(results, list):
resultlist = {}
for result in results:
Expand Down Expand Up @@ -580,12 +580,15 @@ def _execute_vanilla_oslc_query(self, querycapabilityuri, query_params, orderby=
params = {}
params.update(query)
logger.info( f"The parameters for this query are {params}" )

fullurl = f"{query_url}?{urllib.parse.urlencode( params, quote_via=urllib.parse.quote, safe='/')}"
if verbose:
print( f"Full query URL is {fullurl}" )
if self.local_config:
params1 = copy.copy( params )
params1['oslc_config.context'] = self.local_config
fullurlparam = f"{query_url}?{urllib.parse.urlencode( params1, quote_via=urllib.parse.quote, safe='/')}"
print( f"FYI the query URL with local configuration is {fullurlparam}" )

# print( f"Full query URL is {fullurl}" )
# retrieve all pages of results - they will be processed later
total = 1
page = 0
Expand Down Expand Up @@ -689,7 +692,7 @@ def _execute_vanilla_oslc_query(self, querycapabilityuri, query_params, orderby=
if delaybetweenpages>0.0:
time.sleep(delaybetweenpages)

# suppress the Configuration-Context header because it seems that
# after the first page suppress the Configuration-Context header because it seems that
# when that and param oslc_config.context are provided they both get added
# to each nextpage URL which grows ever longer and eventually breaks
# requests see https://github.com/IBM/ELM-Python-Client/discussions/44#discussioncomment-6151370
Expand Down
2,580 changes: 1,287 additions & 1,293 deletions elmclient/tests/results/ccm301.html

Large diffs are not rendered by default.

Loading

0 comments on commit 33a6659

Please sign in to comment.