Skip to content

Commit 44b68ba

Browse files
authored
fix: fix wrong auth being used for pi when using ntlm or basic (#407)
1 parent e85797c commit 44b68ba

2 files changed

Lines changed: 25 additions & 3 deletions

File tree

.snyk

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,30 @@ ignore:
66
reason: 'No patch available'
77
expires: 2025-04-01T00:00:00.000Z
88
created: 2023-12-04T09:05:00.000Z
9+
SNYK-JS-KATEX-8647963:
10+
- '*':
11+
reason: 'No patch available'
12+
expires: 2025-04-01T00:00:00.000Z
13+
created: 2025-02-04T15:29:00.000Z
914
SNYK-PYTHON-PANDAS-8549481:
1015
- '*':
1116
reason: 'No patch available'
1217
expires: 2025-04-01T00:00:00.000Z
1318
created: 2025-01-02T10:30:00.000Z
19+
SNYK-PYTHON-JINJA2-8548181:
20+
- '*':
21+
reason: 'Will patch later'
22+
expires: 2025-04-01T00:00:00.000Z
23+
created: 2025-02-04T15:28:00.000Z
24+
SNYK-PYTHON-JINJA2-8548987:
25+
- '*':
26+
reason: 'Will patch later'
27+
expires: 2025-04-01T00:00:00.000Z
28+
created: 2025-02-04T15:28:00.000Z
29+
SNYK-PYTHON-TORNADO-8400708:
30+
- '*':
31+
reason: ''
32+
expires: 2025-04-01T00:00:00.000Z
33+
created: 2025-02-04T15:28:00.000Z
1434
patch: {}
1535
version: v1.25.0

tagreader/web_handlers.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,7 @@ def __init__(
187187
self.datasource = datasource
188188
self.base_url = url
189189
self.session = requests.Session()
190+
self.auth = auth
190191
self.session.auth = auth if auth is not None else get_auth_aspen()
191192
if verify_ssl is False:
192193
urllib3.disable_warnings(InsecureRequestWarning)
@@ -790,6 +791,7 @@ def generate_search_params(
790791
tag: Optional[str],
791792
desc: Optional[str],
792793
datasource: Optional[str],
794+
auth: Optional[Any] = None,
793795
) -> Dict[str, str]:
794796
q = []
795797
if tag is not None:
@@ -801,7 +803,7 @@ def generate_search_params(
801803

802804
if datasource is not None:
803805
params["dataserverwebid"] = (
804-
f"{get_piwebapi_source_to_webid_dict()[datasource]}"
806+
f"{get_piwebapi_source_to_webid_dict(auth=auth)[datasource]}"
805807
)
806808

807809
return params
@@ -913,7 +915,7 @@ def search(
913915
return_desc: bool = True,
914916
) -> Union[List[Tuple[str, str]], List[str]]:
915917
params = self.generate_search_params(
916-
tag=tag, desc=desc, datasource=self.datasource
918+
tag=tag, desc=desc, datasource=self.datasource, auth=self.auth
917919
)
918920
url = urljoin(self.base_url, "points", "search")
919921
done = False
@@ -969,7 +971,7 @@ def tag_to_web_id(self, tag: str) -> Optional[str]:
969971
return self.web_id_cache[tag]
970972

971973
params = self.generate_search_params(
972-
tag=tag, datasource=self.datasource, desc=None
974+
tag=tag, datasource=self.datasource, desc=None, auth=self.auth
973975
)
974976
url = urljoin(self.base_url, "points", "search")
975977
data = self.fetch(url, params=params)

0 commit comments

Comments
 (0)