blocket-api 0.2.6__tar.gz → 0.2.8__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {blocket_api-0.2.6 → blocket_api-0.2.8}/PKG-INFO +56 -8
- {blocket_api-0.2.6 → blocket_api-0.2.8}/README.md +54 -6
- {blocket_api-0.2.6 → blocket_api-0.2.8}/blocket_api/blocket.py +86 -5
- {blocket_api-0.2.6 → blocket_api-0.2.8}/blocket_api.egg-info/PKG-INFO +56 -8
- {blocket_api-0.2.6 → blocket_api-0.2.8}/blocket_api.egg-info/requires.txt +1 -1
- {blocket_api-0.2.6 → blocket_api-0.2.8}/pyproject.toml +2 -2
- {blocket_api-0.2.6 → blocket_api-0.2.8}/LICENSE +0 -0
- {blocket_api-0.2.6 → blocket_api-0.2.8}/blocket_api/__init__.py +0 -0
- {blocket_api-0.2.6 → blocket_api-0.2.8}/blocket_api/qasa.py +0 -0
- {blocket_api-0.2.6 → blocket_api-0.2.8}/blocket_api.egg-info/SOURCES.txt +0 -0
- {blocket_api-0.2.6 → blocket_api-0.2.8}/blocket_api.egg-info/dependency_links.txt +0 -0
- {blocket_api-0.2.6 → blocket_api-0.2.8}/blocket_api.egg-info/top_level.txt +0 -0
- {blocket_api-0.2.6 → blocket_api-0.2.8}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: blocket_api
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.8
|
|
4
4
|
Summary: A python API wrapper for blocket.se
|
|
5
5
|
Author-email: dunderrrrrr <emil.bjorkroth@gmail.com>
|
|
6
6
|
Requires-Python: >=3.10
|
|
@@ -8,10 +8,10 @@ Description-Content-Type: text/markdown
|
|
|
8
8
|
License-File: LICENSE
|
|
9
9
|
Requires-Dist: httpx>=0.27.0
|
|
10
10
|
Requires-Dist: pre-commit>=3.7.1
|
|
11
|
-
Requires-Dist: ruff>=0.5.2
|
|
12
11
|
Requires-Dist: pytest>=8.2.2
|
|
13
12
|
Requires-Dist: respx>=0.21.1
|
|
14
13
|
Requires-Dist: mypy>=1.15.0
|
|
14
|
+
Requires-Dist: ruff>=0.12.4
|
|
15
15
|
Dynamic: license-file
|
|
16
16
|
|
|
17
17
|
# BlocketAPI
|
|
@@ -25,9 +25,11 @@ BlocketAPI allows users to query saved searches, known as "Bevakningar", on [blo
|
|
|
25
25
|
## ✨ Features
|
|
26
26
|
|
|
27
27
|
- List saved searches, called "Bevakningar".
|
|
28
|
-
-
|
|
29
|
-
-
|
|
30
|
-
-
|
|
28
|
+
- Get listings from all or a specific saved search.
|
|
29
|
+
- Search for anything on Blocket with filters for region and category.
|
|
30
|
+
- Get vehicle information, price evaluation and search for vehicles with multiple filters.
|
|
31
|
+
- Search for homes with filters for city, home type and more.
|
|
32
|
+
- Search for stores and get a specific store's listings.
|
|
31
33
|
|
|
32
34
|
## 🧑💻️ Install
|
|
33
35
|
|
|
@@ -48,7 +50,7 @@ pip install blocket-api
|
|
|
48
50
|
...
|
|
49
51
|
```
|
|
50
52
|
|
|
51
|
-
Some calls require a bearerToken
|
|
53
|
+
Some calls require a `bearerToken`. However, some calls are public and don't require a token.
|
|
52
54
|
|
|
53
55
|
[Where token?](#-blocket-api-token)
|
|
54
56
|
|
|
@@ -61,6 +63,8 @@ Some calls require a bearerToken. However, some calls are public and don't requi
|
|
|
61
63
|
| [`api.motor_search()`](#motor_searchpage-make-fuel-chassi-price-modelyear-milage-gearbox) | 👏 No | Advanced search for car-listings. |
|
|
62
64
|
| [`api.price_eval()`](#price_evalregistration_number) | 👏 No | Vehicle purchase valuation and details. |
|
|
63
65
|
| [`api.home_search()`](#home_searchcity-type-order_by-ordering-offset) | 👏 No | Query home listings.
|
|
66
|
+
| [`api.store_search()`](#store_searchsearch_query-page) | 👏 No | Search for a store.
|
|
67
|
+
| [`api.get_store_listings()`](#get_store_listingsstore_id-page) | 👏 No | Get listings from a specific store.
|
|
64
68
|
|
|
65
69
|
## 🤓 Detailed usage
|
|
66
70
|
|
|
@@ -122,7 +126,8 @@ Make a custom search through out all of blocked. A region can be passed in as pa
|
|
|
122
126
|
|
|
123
127
|
Parameters:
|
|
124
128
|
- `search_query` (`str`, required) - A string to search for.
|
|
125
|
-
- `region` (`
|
|
129
|
+
- `region` (`enum`, optional) - Filter results on a region, default is all of Sweden.
|
|
130
|
+
- `category` (`enum`, optional) - Filter for a specific category, ex. `Category.for_hemmet`.
|
|
126
131
|
- `limit` (`int`, optional) - Limit number of results returned, max is 99.
|
|
127
132
|
|
|
128
133
|
```py
|
|
@@ -184,7 +189,7 @@ Query price evaluation for a specific vehicle by using cars registration number
|
|
|
184
189
|
|
|
185
190
|
- `registration_number` (`str`, required) - Registration number of the vehicle.
|
|
186
191
|
```py
|
|
187
|
-
>>> api.price_eval("ABC123)
|
|
192
|
+
>>> api.price_eval("ABC123")
|
|
188
193
|
{
|
|
189
194
|
"registration_number": "ABC123",
|
|
190
195
|
"private_valuation": 108155,
|
|
@@ -208,6 +213,7 @@ Query home listings from [bostad.blocket.se](https://bostad.blocket.se/).
|
|
|
208
213
|
- `offset` (`int`, optional) - Offset for results, ex. `60`.
|
|
209
214
|
|
|
210
215
|
```py
|
|
216
|
+
>>> from blocket_api.qasa import HomeType, OrderBy
|
|
211
217
|
>>> api.home_search(
|
|
212
218
|
city="Stockholm",
|
|
213
219
|
type=HomeType.apartment,
|
|
@@ -217,6 +223,48 @@ Query home listings from [bostad.blocket.se](https://bostad.blocket.se/).
|
|
|
217
223
|
...
|
|
218
224
|
```
|
|
219
225
|
|
|
226
|
+
### store_search(search_query, page)
|
|
227
|
+
Search for a store in Blocket stores from [blocket.se/butiker](https://www.blocket.se/butiker).
|
|
228
|
+
|
|
229
|
+
- `search_query` (`str`, required) - The name of the store.
|
|
230
|
+
- `page` (`int`, optional) - The page number to return.
|
|
231
|
+
|
|
232
|
+
```py
|
|
233
|
+
>>> api.store_search("Jannes Car and Kebab")
|
|
234
|
+
{
|
|
235
|
+
"data": [
|
|
236
|
+
{
|
|
237
|
+
"store_id": "1234",
|
|
238
|
+
"store_name": "Jannes Car and Kebab",
|
|
239
|
+
...
|
|
240
|
+
},
|
|
241
|
+
...
|
|
242
|
+
]
|
|
243
|
+
}
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
### get_store_listings(store_id, page)
|
|
247
|
+
Get listings from a specific store.
|
|
248
|
+
|
|
249
|
+
- `store_id` (`int`, required) - The store id. Can be obtained by calling `store_search()`.
|
|
250
|
+
- `page` (`int`, optional) - The page number to return.
|
|
251
|
+
|
|
252
|
+
```py
|
|
253
|
+
>>> api.get_store_listings(1234)
|
|
254
|
+
{
|
|
255
|
+
"data": [
|
|
256
|
+
{
|
|
257
|
+
"ad_id": "1234",
|
|
258
|
+
"price": 316000,
|
|
259
|
+
"body": "A very nice car.",
|
|
260
|
+
"images": [],
|
|
261
|
+
...
|
|
262
|
+
},
|
|
263
|
+
...
|
|
264
|
+
]
|
|
265
|
+
}
|
|
266
|
+
```
|
|
267
|
+
|
|
220
268
|
## 🔐 Blocket API token
|
|
221
269
|
|
|
222
270
|
There are two ways to acquire your token:
|
|
@@ -9,9 +9,11 @@ BlocketAPI allows users to query saved searches, known as "Bevakningar", on [blo
|
|
|
9
9
|
## ✨ Features
|
|
10
10
|
|
|
11
11
|
- List saved searches, called "Bevakningar".
|
|
12
|
-
-
|
|
13
|
-
-
|
|
14
|
-
-
|
|
12
|
+
- Get listings from all or a specific saved search.
|
|
13
|
+
- Search for anything on Blocket with filters for region and category.
|
|
14
|
+
- Get vehicle information, price evaluation and search for vehicles with multiple filters.
|
|
15
|
+
- Search for homes with filters for city, home type and more.
|
|
16
|
+
- Search for stores and get a specific store's listings.
|
|
15
17
|
|
|
16
18
|
## 🧑💻️ Install
|
|
17
19
|
|
|
@@ -32,7 +34,7 @@ pip install blocket-api
|
|
|
32
34
|
...
|
|
33
35
|
```
|
|
34
36
|
|
|
35
|
-
Some calls require a bearerToken
|
|
37
|
+
Some calls require a `bearerToken`. However, some calls are public and don't require a token.
|
|
36
38
|
|
|
37
39
|
[Where token?](#-blocket-api-token)
|
|
38
40
|
|
|
@@ -45,6 +47,8 @@ Some calls require a bearerToken. However, some calls are public and don't requi
|
|
|
45
47
|
| [`api.motor_search()`](#motor_searchpage-make-fuel-chassi-price-modelyear-milage-gearbox) | 👏 No | Advanced search for car-listings. |
|
|
46
48
|
| [`api.price_eval()`](#price_evalregistration_number) | 👏 No | Vehicle purchase valuation and details. |
|
|
47
49
|
| [`api.home_search()`](#home_searchcity-type-order_by-ordering-offset) | 👏 No | Query home listings.
|
|
50
|
+
| [`api.store_search()`](#store_searchsearch_query-page) | 👏 No | Search for a store.
|
|
51
|
+
| [`api.get_store_listings()`](#get_store_listingsstore_id-page) | 👏 No | Get listings from a specific store.
|
|
48
52
|
|
|
49
53
|
## 🤓 Detailed usage
|
|
50
54
|
|
|
@@ -106,7 +110,8 @@ Make a custom search through out all of blocked. A region can be passed in as pa
|
|
|
106
110
|
|
|
107
111
|
Parameters:
|
|
108
112
|
- `search_query` (`str`, required) - A string to search for.
|
|
109
|
-
- `region` (`
|
|
113
|
+
- `region` (`enum`, optional) - Filter results on a region, default is all of Sweden.
|
|
114
|
+
- `category` (`enum`, optional) - Filter for a specific category, ex. `Category.for_hemmet`.
|
|
110
115
|
- `limit` (`int`, optional) - Limit number of results returned, max is 99.
|
|
111
116
|
|
|
112
117
|
```py
|
|
@@ -168,7 +173,7 @@ Query price evaluation for a specific vehicle by using cars registration number
|
|
|
168
173
|
|
|
169
174
|
- `registration_number` (`str`, required) - Registration number of the vehicle.
|
|
170
175
|
```py
|
|
171
|
-
>>> api.price_eval("ABC123)
|
|
176
|
+
>>> api.price_eval("ABC123")
|
|
172
177
|
{
|
|
173
178
|
"registration_number": "ABC123",
|
|
174
179
|
"private_valuation": 108155,
|
|
@@ -192,6 +197,7 @@ Query home listings from [bostad.blocket.se](https://bostad.blocket.se/).
|
|
|
192
197
|
- `offset` (`int`, optional) - Offset for results, ex. `60`.
|
|
193
198
|
|
|
194
199
|
```py
|
|
200
|
+
>>> from blocket_api.qasa import HomeType, OrderBy
|
|
195
201
|
>>> api.home_search(
|
|
196
202
|
city="Stockholm",
|
|
197
203
|
type=HomeType.apartment,
|
|
@@ -201,6 +207,48 @@ Query home listings from [bostad.blocket.se](https://bostad.blocket.se/).
|
|
|
201
207
|
...
|
|
202
208
|
```
|
|
203
209
|
|
|
210
|
+
### store_search(search_query, page)
|
|
211
|
+
Search for a store in Blocket stores from [blocket.se/butiker](https://www.blocket.se/butiker).
|
|
212
|
+
|
|
213
|
+
- `search_query` (`str`, required) - The name of the store.
|
|
214
|
+
- `page` (`int`, optional) - The page number to return.
|
|
215
|
+
|
|
216
|
+
```py
|
|
217
|
+
>>> api.store_search("Jannes Car and Kebab")
|
|
218
|
+
{
|
|
219
|
+
"data": [
|
|
220
|
+
{
|
|
221
|
+
"store_id": "1234",
|
|
222
|
+
"store_name": "Jannes Car and Kebab",
|
|
223
|
+
...
|
|
224
|
+
},
|
|
225
|
+
...
|
|
226
|
+
]
|
|
227
|
+
}
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
### get_store_listings(store_id, page)
|
|
231
|
+
Get listings from a specific store.
|
|
232
|
+
|
|
233
|
+
- `store_id` (`int`, required) - The store id. Can be obtained by calling `store_search()`.
|
|
234
|
+
- `page` (`int`, optional) - The page number to return.
|
|
235
|
+
|
|
236
|
+
```py
|
|
237
|
+
>>> api.get_store_listings(1234)
|
|
238
|
+
{
|
|
239
|
+
"data": [
|
|
240
|
+
{
|
|
241
|
+
"ad_id": "1234",
|
|
242
|
+
"price": 316000,
|
|
243
|
+
"body": "A very nice car.",
|
|
244
|
+
"images": [],
|
|
245
|
+
...
|
|
246
|
+
},
|
|
247
|
+
...
|
|
248
|
+
]
|
|
249
|
+
}
|
|
250
|
+
```
|
|
251
|
+
|
|
204
252
|
## 🔐 Blocket API token
|
|
205
253
|
|
|
206
254
|
There are two ways to acquire your token:
|
|
@@ -46,6 +46,52 @@ class Region(Enum):
|
|
|
46
46
|
örebro = 8
|
|
47
47
|
|
|
48
48
|
|
|
49
|
+
class Category(Enum):
|
|
50
|
+
fordon = 1000
|
|
51
|
+
bilar = 1020
|
|
52
|
+
bildelar_biltillbehor = 1040
|
|
53
|
+
batar = 1060
|
|
54
|
+
batdelar_tillbehor = 1080
|
|
55
|
+
husvagnar_husbilar = 1100
|
|
56
|
+
mopeder_a_traktor = 1120
|
|
57
|
+
motorcyklar = 1140
|
|
58
|
+
mc_delar_tillbehor = 1160
|
|
59
|
+
lastbil_truck_entreprenad = 1220
|
|
60
|
+
skogs_lantbruksmaskiner = 1240
|
|
61
|
+
snoskotrar = 1180
|
|
62
|
+
snoskoterdelar_tillbehor = 1200
|
|
63
|
+
for_hemmet = 2000
|
|
64
|
+
bygg_tradgard = 2020
|
|
65
|
+
mobler_heminredning = 2040
|
|
66
|
+
husgerad_vitvaror = 2060
|
|
67
|
+
verktyg = 2026
|
|
68
|
+
bostad = 3000
|
|
69
|
+
lagenheter = 3020
|
|
70
|
+
villor = 3100
|
|
71
|
+
radhus = 3120
|
|
72
|
+
tomter = 3060
|
|
73
|
+
gardar = 3070
|
|
74
|
+
fritidsboende = 3040
|
|
75
|
+
utland = 3080
|
|
76
|
+
personligt = 4000
|
|
77
|
+
klader_skor = 4080
|
|
78
|
+
accessoarer_klockor = 4060
|
|
79
|
+
barnklader_skor = 4020
|
|
80
|
+
barnartiklar_leksaker = 4040
|
|
81
|
+
elektronik = 5000
|
|
82
|
+
datorer_tv_spel = 5020
|
|
83
|
+
ljud_bild = 5040
|
|
84
|
+
telefoner_tillbehor = 5060
|
|
85
|
+
fritid_hobby = 6000
|
|
86
|
+
biljetter_resor = 6020
|
|
87
|
+
bocker_studentlitteratur = 6040
|
|
88
|
+
cyklar = 6060
|
|
89
|
+
djur = 6080
|
|
90
|
+
hobby_samlarprylar = 6100
|
|
91
|
+
hastar_ridsport = 6120
|
|
92
|
+
jakt_fiske = 6140
|
|
93
|
+
|
|
94
|
+
|
|
49
95
|
MAKE_OPTIONS = Literal[
|
|
50
96
|
"Audi",
|
|
51
97
|
"BMW",
|
|
@@ -188,7 +234,11 @@ class BlocketAPI:
|
|
|
188
234
|
|
|
189
235
|
@public_token
|
|
190
236
|
def custom_search(
|
|
191
|
-
self,
|
|
237
|
+
self,
|
|
238
|
+
search_query: str,
|
|
239
|
+
region: Region = Region.hela_sverige,
|
|
240
|
+
category: Category | None = None,
|
|
241
|
+
limit: int = 99,
|
|
192
242
|
) -> dict:
|
|
193
243
|
"""
|
|
194
244
|
Do a custom search through out all of Blocket.
|
|
@@ -199,10 +249,12 @@ class BlocketAPI:
|
|
|
199
249
|
if limit > 99:
|
|
200
250
|
raise LimitError("Limit cannot be greater than 99.")
|
|
201
251
|
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
252
|
+
url = f"{BASE_URL}/search_bff/v2/content?lim={limit}&q={search_query}&r={region.value}&status=active"
|
|
253
|
+
|
|
254
|
+
if category:
|
|
255
|
+
url += f"&cg={category.value}"
|
|
256
|
+
|
|
257
|
+
return _make_request(url=url, token=self.token).json()
|
|
206
258
|
|
|
207
259
|
@public_token
|
|
208
260
|
def motor_search(
|
|
@@ -282,3 +334,32 @@ class BlocketAPI:
|
|
|
282
334
|
ordering=ordering,
|
|
283
335
|
offset=offset,
|
|
284
336
|
).search()
|
|
337
|
+
|
|
338
|
+
@public_token
|
|
339
|
+
def search_store(
|
|
340
|
+
self,
|
|
341
|
+
search_query: str,
|
|
342
|
+
page: int = 0,
|
|
343
|
+
) -> dict:
|
|
344
|
+
"""
|
|
345
|
+
Searching through Blocket stores from https://www.blocket.se/butiker.
|
|
346
|
+
The store_id is used for get_store_listings().
|
|
347
|
+
"""
|
|
348
|
+
url = f"{BASE_URL}/search_bff/v1/stores?q={search_query}&page={page}"
|
|
349
|
+
return _make_request(url=f"{url}", token=self.token).json()
|
|
350
|
+
|
|
351
|
+
@public_token
|
|
352
|
+
def get_store_listings(
|
|
353
|
+
self,
|
|
354
|
+
store_id: int,
|
|
355
|
+
page: int = 0,
|
|
356
|
+
) -> dict:
|
|
357
|
+
"""
|
|
358
|
+
Return all listings from a specific store from https://www.blocket.se/butik/<store>.
|
|
359
|
+
The store_id can be found by searching for the store with search_store().
|
|
360
|
+
"""
|
|
361
|
+
url = (
|
|
362
|
+
f"{BASE_URL}/search_bff/v2/content?lim=60&page={page}&sort=rel&store_id={store_id}"
|
|
363
|
+
"&status=active&gl=3&include=extend_with_shipping"
|
|
364
|
+
)
|
|
365
|
+
return _make_request(url=f"{url}", token=self.token).json()
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: blocket_api
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.8
|
|
4
4
|
Summary: A python API wrapper for blocket.se
|
|
5
5
|
Author-email: dunderrrrrr <emil.bjorkroth@gmail.com>
|
|
6
6
|
Requires-Python: >=3.10
|
|
@@ -8,10 +8,10 @@ Description-Content-Type: text/markdown
|
|
|
8
8
|
License-File: LICENSE
|
|
9
9
|
Requires-Dist: httpx>=0.27.0
|
|
10
10
|
Requires-Dist: pre-commit>=3.7.1
|
|
11
|
-
Requires-Dist: ruff>=0.5.2
|
|
12
11
|
Requires-Dist: pytest>=8.2.2
|
|
13
12
|
Requires-Dist: respx>=0.21.1
|
|
14
13
|
Requires-Dist: mypy>=1.15.0
|
|
14
|
+
Requires-Dist: ruff>=0.12.4
|
|
15
15
|
Dynamic: license-file
|
|
16
16
|
|
|
17
17
|
# BlocketAPI
|
|
@@ -25,9 +25,11 @@ BlocketAPI allows users to query saved searches, known as "Bevakningar", on [blo
|
|
|
25
25
|
## ✨ Features
|
|
26
26
|
|
|
27
27
|
- List saved searches, called "Bevakningar".
|
|
28
|
-
-
|
|
29
|
-
-
|
|
30
|
-
-
|
|
28
|
+
- Get listings from all or a specific saved search.
|
|
29
|
+
- Search for anything on Blocket with filters for region and category.
|
|
30
|
+
- Get vehicle information, price evaluation and search for vehicles with multiple filters.
|
|
31
|
+
- Search for homes with filters for city, home type and more.
|
|
32
|
+
- Search for stores and get a specific store's listings.
|
|
31
33
|
|
|
32
34
|
## 🧑💻️ Install
|
|
33
35
|
|
|
@@ -48,7 +50,7 @@ pip install blocket-api
|
|
|
48
50
|
...
|
|
49
51
|
```
|
|
50
52
|
|
|
51
|
-
Some calls require a bearerToken
|
|
53
|
+
Some calls require a `bearerToken`. However, some calls are public and don't require a token.
|
|
52
54
|
|
|
53
55
|
[Where token?](#-blocket-api-token)
|
|
54
56
|
|
|
@@ -61,6 +63,8 @@ Some calls require a bearerToken. However, some calls are public and don't requi
|
|
|
61
63
|
| [`api.motor_search()`](#motor_searchpage-make-fuel-chassi-price-modelyear-milage-gearbox) | 👏 No | Advanced search for car-listings. |
|
|
62
64
|
| [`api.price_eval()`](#price_evalregistration_number) | 👏 No | Vehicle purchase valuation and details. |
|
|
63
65
|
| [`api.home_search()`](#home_searchcity-type-order_by-ordering-offset) | 👏 No | Query home listings.
|
|
66
|
+
| [`api.store_search()`](#store_searchsearch_query-page) | 👏 No | Search for a store.
|
|
67
|
+
| [`api.get_store_listings()`](#get_store_listingsstore_id-page) | 👏 No | Get listings from a specific store.
|
|
64
68
|
|
|
65
69
|
## 🤓 Detailed usage
|
|
66
70
|
|
|
@@ -122,7 +126,8 @@ Make a custom search through out all of blocked. A region can be passed in as pa
|
|
|
122
126
|
|
|
123
127
|
Parameters:
|
|
124
128
|
- `search_query` (`str`, required) - A string to search for.
|
|
125
|
-
- `region` (`
|
|
129
|
+
- `region` (`enum`, optional) - Filter results on a region, default is all of Sweden.
|
|
130
|
+
- `category` (`enum`, optional) - Filter for a specific category, ex. `Category.for_hemmet`.
|
|
126
131
|
- `limit` (`int`, optional) - Limit number of results returned, max is 99.
|
|
127
132
|
|
|
128
133
|
```py
|
|
@@ -184,7 +189,7 @@ Query price evaluation for a specific vehicle by using cars registration number
|
|
|
184
189
|
|
|
185
190
|
- `registration_number` (`str`, required) - Registration number of the vehicle.
|
|
186
191
|
```py
|
|
187
|
-
>>> api.price_eval("ABC123)
|
|
192
|
+
>>> api.price_eval("ABC123")
|
|
188
193
|
{
|
|
189
194
|
"registration_number": "ABC123",
|
|
190
195
|
"private_valuation": 108155,
|
|
@@ -208,6 +213,7 @@ Query home listings from [bostad.blocket.se](https://bostad.blocket.se/).
|
|
|
208
213
|
- `offset` (`int`, optional) - Offset for results, ex. `60`.
|
|
209
214
|
|
|
210
215
|
```py
|
|
216
|
+
>>> from blocket_api.qasa import HomeType, OrderBy
|
|
211
217
|
>>> api.home_search(
|
|
212
218
|
city="Stockholm",
|
|
213
219
|
type=HomeType.apartment,
|
|
@@ -217,6 +223,48 @@ Query home listings from [bostad.blocket.se](https://bostad.blocket.se/).
|
|
|
217
223
|
...
|
|
218
224
|
```
|
|
219
225
|
|
|
226
|
+
### store_search(search_query, page)
|
|
227
|
+
Search for a store in Blocket stores from [blocket.se/butiker](https://www.blocket.se/butiker).
|
|
228
|
+
|
|
229
|
+
- `search_query` (`str`, required) - The name of the store.
|
|
230
|
+
- `page` (`int`, optional) - The page number to return.
|
|
231
|
+
|
|
232
|
+
```py
|
|
233
|
+
>>> api.store_search("Jannes Car and Kebab")
|
|
234
|
+
{
|
|
235
|
+
"data": [
|
|
236
|
+
{
|
|
237
|
+
"store_id": "1234",
|
|
238
|
+
"store_name": "Jannes Car and Kebab",
|
|
239
|
+
...
|
|
240
|
+
},
|
|
241
|
+
...
|
|
242
|
+
]
|
|
243
|
+
}
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
### get_store_listings(store_id, page)
|
|
247
|
+
Get listings from a specific store.
|
|
248
|
+
|
|
249
|
+
- `store_id` (`int`, required) - The store id. Can be obtained by calling `store_search()`.
|
|
250
|
+
- `page` (`int`, optional) - The page number to return.
|
|
251
|
+
|
|
252
|
+
```py
|
|
253
|
+
>>> api.get_store_listings(1234)
|
|
254
|
+
{
|
|
255
|
+
"data": [
|
|
256
|
+
{
|
|
257
|
+
"ad_id": "1234",
|
|
258
|
+
"price": 316000,
|
|
259
|
+
"body": "A very nice car.",
|
|
260
|
+
"images": [],
|
|
261
|
+
...
|
|
262
|
+
},
|
|
263
|
+
...
|
|
264
|
+
]
|
|
265
|
+
}
|
|
266
|
+
```
|
|
267
|
+
|
|
220
268
|
## 🔐 Blocket API token
|
|
221
269
|
|
|
222
270
|
There are two ways to acquire your token:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "blocket_api"
|
|
3
|
-
version = "0.2.
|
|
3
|
+
version = "0.2.8"
|
|
4
4
|
description = "A python API wrapper for blocket.se"
|
|
5
5
|
authors = [{name = "dunderrrrrr", email = "emil.bjorkroth@gmail.com"}]
|
|
6
6
|
readme = "README.md"
|
|
@@ -8,10 +8,10 @@ requires-python = ">=3.10"
|
|
|
8
8
|
dependencies = [
|
|
9
9
|
"httpx>=0.27.0",
|
|
10
10
|
"pre-commit>=3.7.1",
|
|
11
|
-
"ruff>=0.5.2",
|
|
12
11
|
"pytest>=8.2.2",
|
|
13
12
|
"respx>=0.21.1",
|
|
14
13
|
"mypy>=1.15.0",
|
|
14
|
+
"ruff>=0.12.4",
|
|
15
15
|
]
|
|
16
16
|
|
|
17
17
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|