|
3 | 3 | # SPDX-License-Identifier: MIT
|
4 | 4 | ##
|
5 | 5 |
|
6 |
| - |
| 6 | +import copy |
7 | 7 | import logging
|
8 | 8 | import re
|
9 | 9 | import time
|
@@ -338,7 +338,7 @@ def _evaluate_steps(self, querycapabilityuri,querysteps,*,resultstack=None, sele
|
338 | 338 | # raise Exception( f"Very strange parse result! {step}" )
|
339 | 339 | else:
|
340 | 340 | # do an actual query
|
341 |
| - 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) |
| 341 | + 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") |
342 | 342 | if isinstance(results, list):
|
343 | 343 | resultlist = {}
|
344 | 344 | for result in results:
|
@@ -580,12 +580,15 @@ def _execute_vanilla_oslc_query(self, querycapabilityuri, query_params, orderby=
|
580 | 580 | params = {}
|
581 | 581 | params.update(query)
|
582 | 582 | logger.info( f"The parameters for this query are {params}" )
|
583 |
| - |
584 | 583 | fullurl = f"{query_url}?{urllib.parse.urlencode( params, quote_via=urllib.parse.quote, safe='/')}"
|
585 | 584 | if verbose:
|
586 | 585 | print( f"Full query URL is {fullurl}" )
|
| 586 | + if self.local_config: |
| 587 | + params1 = copy.copy( params ) |
| 588 | + params1['oslc_config.context'] = self.local_config |
| 589 | + fullurlparam = f"{query_url}?{urllib.parse.urlencode( params1, quote_via=urllib.parse.quote, safe='/')}" |
| 590 | + print( f"FYI the query URL with local configuration is {fullurlparam}" ) |
587 | 591 |
|
588 |
| -# print( f"Full query URL is {fullurl}" ) |
589 | 592 | # retrieve all pages of results - they will be processed later
|
590 | 593 | total = 1
|
591 | 594 | page = 0
|
@@ -689,7 +692,7 @@ def _execute_vanilla_oslc_query(self, querycapabilityuri, query_params, orderby=
|
689 | 692 | if delaybetweenpages>0.0:
|
690 | 693 | time.sleep(delaybetweenpages)
|
691 | 694 |
|
692 |
| - # suppress the Configuration-Context header because it seems that |
| 695 | + # after the first page suppress the Configuration-Context header because it seems that |
693 | 696 | # when that and param oslc_config.context are provided they both get added
|
694 | 697 | # to each nextpage URL which grows ever longer and eventually breaks
|
695 | 698 | # requests see https://github.com/IBM/ELM-Python-Client/discussions/44#discussioncomment-6151370
|
|
0 commit comments