File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -82,7 +82,7 @@ optional-dependencies.dev = [
8282 " ty==0.0.17" ,
8383 " types-requests==2.32.4.20260107" ,
8484 " vulture==2.14" ,
85- " vws-python-mock==2026.2.21 " ,
85+ " vws-python-mock==2026.2.22.2 " ,
8686 " vws-test-fixtures==2023.3.5" ,
8787 " yamlfix==1.19.1" ,
8888 " zizmor==1.22.0" ,
Original file line number Diff line number Diff line change 22API.
33"""
44
5- from urllib .parse import urljoin
6-
75import requests
86from beartype import BeartypeConf , beartype
97from vws_auth_tools import authorization_header , rfc_1123_date
@@ -64,7 +62,7 @@ def target_api_request(
6462 ** extra_headers ,
6563 }
6664
67- url = urljoin ( base = base_vws_url , url = request_path )
65+ url = base_vws_url . rstrip ( "/" ) + request_path
6866
6967 requests_response = requests .request (
7068 method = method ,
Original file line number Diff line number Diff line change 55import json
66from http import HTTPMethod , HTTPStatus
77from typing import Any , BinaryIO
8- from urllib .parse import urljoin
98
109import requests
1110from beartype import BeartypeConf , beartype
@@ -146,7 +145,7 @@ def query(
146145
147146 requests_response = requests .request (
148147 method = method ,
149- url = urljoin ( base = self ._base_vwq_url , url = request_path ) ,
148+ url = self ._base_vwq_url . rstrip ( "/" ) + request_path ,
150149 headers = headers ,
151150 data = content ,
152151 timeout = self ._request_timeout_seconds ,
Original file line number Diff line number Diff line change @@ -190,6 +190,39 @@ def test_custom_base_url(image: io.BytesIO | BinaryIO) -> None:
190190 match = matches [0 ]
191191 assert match .target_id == target_id
192192
193+ @staticmethod
194+ def test_custom_base_url_with_path_prefix (
195+ image : io .BytesIO | BinaryIO ,
196+ ) -> None :
197+ """
198+ A base VWQ URL with a path prefix is used as-is, without the
199+ prefix being dropped.
200+ """
201+ base_vwq_url = "http://example.com/prefix"
202+ with MockVWS (base_vwq_url = base_vwq_url ) as mock :
203+ database = CloudDatabase ()
204+ mock .add_cloud_database (cloud_database = database )
205+ vws_client = VWS (
206+ server_access_key = database .server_access_key ,
207+ server_secret_key = database .server_secret_key ,
208+ )
209+ target_id = vws_client .add_target (
210+ name = "x" ,
211+ width = 1 ,
212+ image = image ,
213+ active_flag = True ,
214+ application_metadata = None ,
215+ )
216+ vws_client .wait_for_target_processed (target_id = target_id )
217+ cloud_reco_client = CloudRecoService (
218+ client_access_key = database .client_access_key ,
219+ client_secret_key = database .client_secret_key ,
220+ base_vwq_url = base_vwq_url ,
221+ )
222+
223+ matches = cloud_reco_client .query (image = image )
224+ assert len (matches ) == 1
225+
193226
194227class TestMaxNumResults :
195228 """Tests for the ``max_num_results`` parameter of ``query``."""
Original file line number Diff line number Diff line change @@ -246,6 +246,24 @@ def test_custom_base_url(image: io.BytesIO | BinaryIO) -> None:
246246 application_metadata = None ,
247247 )
248248
249+ @staticmethod
250+ def test_custom_base_url_with_path_prefix () -> None :
251+ """
252+ A base VWS URL with a path prefix is used as-is, without the
253+ prefix being dropped.
254+ """
255+ base_vws_url = "http://example.com/prefix"
256+ with MockVWS (base_vws_url = base_vws_url ) as mock :
257+ database = CloudDatabase ()
258+ mock .add_cloud_database (cloud_database = database )
259+ vws_client = VWS (
260+ server_access_key = database .server_access_key ,
261+ server_secret_key = database .server_secret_key ,
262+ base_vws_url = base_vws_url ,
263+ )
264+
265+ assert not vws_client .list_targets ()
266+
249267
250268class TestListTargets :
251269 """Tests for listing targets."""
You can’t perform that action at this time.
0 commit comments