Skip to content

Commit 2e5e5de

Browse files
committed
fix: transmission list bug
This should be a list, not one single CarTransmission instance. Also needs to be updated in api.
1 parent ab63b98 commit 2e5e5de

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ api.search_car(
5454
colors=[CarColor.GULD],
5555
price_from=10000,
5656
price_to=50000,
57-
transmission=CarTransmission.MANUAL,
57+
transmissions=[CarTransmission.MANUAL],
5858
locations=[Location.STOCKHOLM],
5959
)
6060

blocket_api/blocket.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ def search_car(
8080
milage_from: int | None = None,
8181
milage_to: int | None = None,
8282
colors: list[CarColor] = [],
83-
transmission: list[CarTransmission] = [],
83+
transmissions: list[CarTransmission] = [],
8484
) -> Any:
8585
url = f"{SITE_URL}/mobility/search/api/search/SEARCH_ID_CAR_USED"
8686
params = [
@@ -95,7 +95,7 @@ def search_car(
9595
*([QueryParam("milage_from", milage_from)] if milage_from else []),
9696
*([QueryParam("milage_to", milage_to)] if milage_to else []),
9797
*[QueryParam("exterior_colour", color.value) for color in colors],
98-
*[QueryParam("transmission", t.value) for t in transmission],
98+
*[QueryParam("transmission", t.value) for t in transmissions],
9999
]
100100

101101
return _request(url=url, params=params).json()

tests/requests.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
CarAd,
77
CarModel,
88
CarSortOrder,
9+
CarTransmission,
910
Category,
1011
Location,
1112
RecommerceAd,
@@ -111,6 +112,7 @@ def test_search_car(self) -> None:
111112
"&make=0.744"
112113
"&price_from=1000"
113114
"&price_to=50000"
115+
"&transmission=2"
114116
)
115117
respx.get(expected_url).mock(
116118
return_value=httpx.Response(200, json={"status": "ok"})
@@ -120,6 +122,7 @@ def test_search_car(self) -> None:
120122
models=[CarModel.AUDI],
121123
price_from=1000,
122124
price_to=50000,
125+
transmissions=[CarTransmission.AUTOMATIC],
123126
)
124127
assert result == {"status": "ok"}
125128

0 commit comments

Comments
 (0)