blocket-api 0.2.8__tar.gz → 0.3.0__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.8 → blocket_api-0.3.0}/PKG-INFO +62 -24
- {blocket_api-0.2.8 → blocket_api-0.3.0}/README.md +59 -22
- {blocket_api-0.2.8 → blocket_api-0.3.0}/blocket_api/blocket.py +219 -16
- blocket_api-0.3.0/blocket_api/models.py +536 -0
- {blocket_api-0.2.8 → blocket_api-0.3.0}/blocket_api.egg-info/PKG-INFO +62 -24
- {blocket_api-0.2.8 → blocket_api-0.3.0}/blocket_api.egg-info/SOURCES.txt +1 -0
- {blocket_api-0.2.8 → blocket_api-0.3.0}/blocket_api.egg-info/requires.txt +2 -1
- {blocket_api-0.2.8 → blocket_api-0.3.0}/pyproject.toml +3 -2
- {blocket_api-0.2.8 → blocket_api-0.3.0}/LICENSE +0 -0
- {blocket_api-0.2.8 → blocket_api-0.3.0}/blocket_api/__init__.py +0 -0
- {blocket_api-0.2.8 → blocket_api-0.3.0}/blocket_api/qasa.py +0 -0
- {blocket_api-0.2.8 → blocket_api-0.3.0}/blocket_api.egg-info/dependency_links.txt +0 -0
- {blocket_api-0.2.8 → blocket_api-0.3.0}/blocket_api.egg-info/top_level.txt +0 -0
- {blocket_api-0.2.8 → blocket_api-0.3.0}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: blocket_api
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.3.0
|
|
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
|
|
@@ -11,14 +11,15 @@ Requires-Dist: pre-commit>=3.7.1
|
|
|
11
11
|
Requires-Dist: pytest>=8.2.2
|
|
12
12
|
Requires-Dist: respx>=0.21.1
|
|
13
13
|
Requires-Dist: mypy>=1.15.0
|
|
14
|
-
Requires-Dist:
|
|
14
|
+
Requires-Dist: pydantic>=2.11.7
|
|
15
|
+
Requires-Dist: ruff>=0.13.1
|
|
15
16
|
Dynamic: license-file
|
|
16
17
|
|
|
17
18
|
# BlocketAPI
|
|
18
19
|
|
|
19
|
-
[](https://pypi.org/project/blocket_api/) [](https://github.com/dunderrrrrr/blocket_api/blob/main/LICENSE)
|
|
20
|
+
[](https://pypi.org/project/blocket_api/) [](https://github.com/dunderrrrrr/blocket_api/blob/main/LICENSE)  
|
|
20
21
|
|
|
21
|
-
BlocketAPI allows users to query saved searches, known as "Bevakningar", on [blocket.se](https://blocket.se/). This means you can either retrieve results from a specific saved search or list all listings/ads across all saved searches. The results from these queries are returned in a `json` format.
|
|
22
|
+
BlocketAPI allows users to query saved searches, known as "Bevakningar", on [blocket.se](https://blocket.se/). This means you can either retrieve results from a specific saved search or list all listings/ads across all saved searches. The results from these queries are returned in a `json` format or as cleaned pydantic objects.
|
|
22
23
|
|
|
23
24
|
> Blocket is one of Sweden's largest online marketplaces. It was founded in 1996 and allows users to buy and sell a wide range of items, including cars, real estate, jobs, services, and second-hand goods. The platform is known for its extensive reach and user-friendly interface, making it a popular choice for Swedes looking to purchase or sell items quickly and efficiently.
|
|
24
25
|
|
|
@@ -33,12 +34,14 @@ BlocketAPI allows users to query saved searches, known as "Bevakningar", on [blo
|
|
|
33
34
|
|
|
34
35
|
## 🧑💻️ Install
|
|
35
36
|
|
|
36
|
-
BlocketAPI
|
|
37
|
+
Install BlocketAPI via PyPI...
|
|
37
38
|
|
|
38
39
|
```sh
|
|
39
40
|
pip install blocket-api
|
|
40
41
|
```
|
|
41
42
|
|
|
43
|
+
or use [blocket-api.se](https://blocket-api.se) without installing anything!
|
|
44
|
+
|
|
42
45
|
## 💁♀️ Usage
|
|
43
46
|
|
|
44
47
|
```py
|
|
@@ -55,20 +58,22 @@ Some calls require a `bearerToken`. However, some calls are public and don't req
|
|
|
55
58
|
[Where token?](#-blocket-api-token)
|
|
56
59
|
|
|
57
60
|
|
|
58
|
-
| Function | Token required | Description |
|
|
59
|
-
|
|
60
|
-
| [`api.saved_searches()`](#saved_searches) | 🔐 Yes | List your saved searches (bevakningar) |
|
|
61
|
-
| [`api.get_listings()`](#
|
|
62
|
-
| [`api.custom_search()`](#
|
|
63
|
-
| [`api.motor_search()`](#
|
|
64
|
-
| [`api.price_eval()`](#
|
|
65
|
-
| [`api.home_search()`](#
|
|
66
|
-
| [`api.store_search()`](#
|
|
67
|
-
| [`api.get_store_listings()`](#
|
|
61
|
+
| Function | Token required | `as_objects` | Description |
|
|
62
|
+
|---|---|---|---|
|
|
63
|
+
| [`api.saved_searches()`](#saved_searches) | 🔐 Yes | - | List your saved searches (bevakningar) |
|
|
64
|
+
| [`api.get_listings()`](#get_listings) | 🔐 Yes | - | List items related to a saved search |
|
|
65
|
+
| [`api.custom_search()`](#custom_search) | 👏 No | Yes | Search for everything on Blocket and filter by region |
|
|
66
|
+
| [`api.motor_search()`](#motor_search) | 👏 No | Yes | Advanced search for car-listings. |
|
|
67
|
+
| [`api.price_eval()`](#price_eval) | 👏 No | - | Vehicle purchase valuation and details. |
|
|
68
|
+
| [`api.home_search()`](#home_search) | 👏 No | Yes | Query home listings.
|
|
69
|
+
| [`api.store_search()`](#store_search) | 👏 No | Yes | Search for a store.
|
|
70
|
+
| [`api.get_store_listings()`](#get_store_listings) | 👏 No | Yes | Get listings from a specific store.
|
|
71
|
+
| [`api.get_ad_by_id()`](#get_ad_by_id) | 👏 No | Yes | Get ad data from id.
|
|
72
|
+
|
|
68
73
|
|
|
69
74
|
## 🤓 Detailed usage
|
|
70
75
|
|
|
71
|
-
### saved_searches
|
|
76
|
+
### saved_searches
|
|
72
77
|
|
|
73
78
|
Saved searches are your so called "Bevakningar" and can be found [here](https://www.blocket.se/sparade/bevakningar). Each saved search has and unique `id` which can be used as a parameter to `get_listings()`, see below.
|
|
74
79
|
|
|
@@ -87,7 +92,7 @@ Saved searches are your so called "Bevakningar" and can be found [here](https://
|
|
|
87
92
|
]
|
|
88
93
|
```
|
|
89
94
|
|
|
90
|
-
### get_listings
|
|
95
|
+
### get_listings
|
|
91
96
|
Returns all listings related to a saved search.
|
|
92
97
|
|
|
93
98
|
Parameters:
|
|
@@ -121,7 +126,7 @@ Parameters:
|
|
|
121
126
|
}
|
|
122
127
|
```
|
|
123
128
|
|
|
124
|
-
### custom_search
|
|
129
|
+
### custom_search
|
|
125
130
|
Make a custom search through out all of blocked. A region can be passed in as parameter for filtering.
|
|
126
131
|
|
|
127
132
|
Parameters:
|
|
@@ -129,9 +134,10 @@ Parameters:
|
|
|
129
134
|
- `region` (`enum`, optional) - Filter results on a region, default is all of Sweden.
|
|
130
135
|
- `category` (`enum`, optional) - Filter for a specific category, ex. `Category.for_hemmet`.
|
|
131
136
|
- `limit` (`int`, optional) - Limit number of results returned, max is 99.
|
|
137
|
+
- `as_objects` (`bool`, optional) - Return results as pydantic models, default is `False`.
|
|
132
138
|
|
|
133
139
|
```py
|
|
134
|
-
>>> from blocket_api import Region
|
|
140
|
+
>>> from blocket_api.blocket import Region, Category
|
|
135
141
|
>>> api.custom_search("saab", Region.blekinge) # search for term "saab" in region of "Blekinge"
|
|
136
142
|
{
|
|
137
143
|
"data":[
|
|
@@ -162,7 +168,7 @@ Parameters:
|
|
|
162
168
|
}
|
|
163
169
|
```
|
|
164
170
|
|
|
165
|
-
### motor_search
|
|
171
|
+
### motor_search
|
|
166
172
|
To query listings related to a specific car, supply the following parameters:
|
|
167
173
|
|
|
168
174
|
- `page` (`int`, required) - Results are split in pages, set page number here.
|
|
@@ -173,6 +179,8 @@ To query listings related to a specific car, supply the following parameters:
|
|
|
173
179
|
- `modelYear` (`Optional[Tuple[int, int]]`) - Set model year range, ex. `(2000, 2020)`.
|
|
174
180
|
- `milage` (`Optional[Tuple[int, int]]`) - Set milage range, ex. `(1000, 2000)`.
|
|
175
181
|
- `gearbox` (`Optional[GEARBOX_OPTIONS]`) - Filter a specific gearbox, ex. `Automat`.
|
|
182
|
+
- `as_objects` (`bool`, optional) - Return results as pydantic models, default is `False`.
|
|
183
|
+
|
|
176
184
|
```py
|
|
177
185
|
>>> api.motor_search(
|
|
178
186
|
make=["Audi", "Ford"],
|
|
@@ -184,7 +192,7 @@ To query listings related to a specific car, supply the following parameters:
|
|
|
184
192
|
...
|
|
185
193
|
```
|
|
186
194
|
|
|
187
|
-
### price_eval
|
|
195
|
+
### price_eval
|
|
188
196
|
Query price evaluation for a specific vehicle by using cars registration number (ABC123). This returns company and private estimated prices, car information, and more. The api queries same endpoint as Blockets ["värdera bil"](https://www.blocket.se/tjanster/vardera-bil) service.
|
|
189
197
|
|
|
190
198
|
- `registration_number` (`str`, required) - Registration number of the vehicle.
|
|
@@ -203,7 +211,7 @@ Query price evaluation for a specific vehicle by using cars registration number
|
|
|
203
211
|
}
|
|
204
212
|
```
|
|
205
213
|
|
|
206
|
-
### home_search
|
|
214
|
+
### home_search
|
|
207
215
|
Query home listings from [bostad.blocket.se](https://bostad.blocket.se/).
|
|
208
216
|
|
|
209
217
|
- `city` (`str`, required) - City name, ex. Stockholm.
|
|
@@ -211,6 +219,7 @@ Query home listings from [bostad.blocket.se](https://bostad.blocket.se/).
|
|
|
211
219
|
- `order_by` (`OrderBy`, optional) - Sorting order, ex. `OrderBy.price`.
|
|
212
220
|
- `ordering` (`HOME_SEARCH_ORDERING`, optional) - Sorting order, ex. `"descending"`.
|
|
213
221
|
- `offset` (`int`, optional) - Offset for results, ex. `60`.
|
|
222
|
+
- `as_objects` (`bool`, optional) - Return results as pydantic models, default is False.
|
|
214
223
|
|
|
215
224
|
```py
|
|
216
225
|
>>> from blocket_api.qasa import HomeType, OrderBy
|
|
@@ -223,11 +232,13 @@ Query home listings from [bostad.blocket.se](https://bostad.blocket.se/).
|
|
|
223
232
|
...
|
|
224
233
|
```
|
|
225
234
|
|
|
226
|
-
### store_search
|
|
235
|
+
### store_search
|
|
227
236
|
Search for a store in Blocket stores from [blocket.se/butiker](https://www.blocket.se/butiker).
|
|
228
237
|
|
|
229
238
|
- `search_query` (`str`, required) - The name of the store.
|
|
230
239
|
- `page` (`int`, optional) - The page number to return.
|
|
240
|
+
- `as_objects` (`bool`, optional) - Return results as pydantic models, default is `False`.
|
|
241
|
+
|
|
231
242
|
|
|
232
243
|
```py
|
|
233
244
|
>>> api.store_search("Jannes Car and Kebab")
|
|
@@ -243,11 +254,13 @@ Search for a store in Blocket stores from [blocket.se/butiker](https://www.block
|
|
|
243
254
|
}
|
|
244
255
|
```
|
|
245
256
|
|
|
246
|
-
### get_store_listings
|
|
257
|
+
### get_store_listings
|
|
247
258
|
Get listings from a specific store.
|
|
248
259
|
|
|
249
260
|
- `store_id` (`int`, required) - The store id. Can be obtained by calling `store_search()`.
|
|
250
261
|
- `page` (`int`, optional) - The page number to return.
|
|
262
|
+
- `as_objects` (`bool`, optional) - Return results as pydantic models, default is `False`.
|
|
263
|
+
|
|
251
264
|
|
|
252
265
|
```py
|
|
253
266
|
>>> api.get_store_listings(1234)
|
|
@@ -265,6 +278,30 @@ Get listings from a specific store.
|
|
|
265
278
|
}
|
|
266
279
|
```
|
|
267
280
|
|
|
281
|
+
### get_ad_by_id
|
|
282
|
+
Get ad data from a specific ad id.
|
|
283
|
+
|
|
284
|
+
- `ad_id` (`int`, required) - The ad id. Can be found by calling any other method or from ad url.
|
|
285
|
+
- `as_objects` (`bool`, optional) - Return results as pydantic models, default is `False`.
|
|
286
|
+
|
|
287
|
+
|
|
288
|
+
```py
|
|
289
|
+
>>> api.get_ad_by_id(1234)
|
|
290
|
+
{
|
|
291
|
+
"data": {
|
|
292
|
+
"ad_id": "1234",
|
|
293
|
+
"ad_status": "active",
|
|
294
|
+
"advertiser": {...},
|
|
295
|
+
"body": "A nice ad.",
|
|
296
|
+
"category": [
|
|
297
|
+
{"id": "4000", "name": "Personligt"},
|
|
298
|
+
{"id": "4080", "name": "Kläder & skor"},
|
|
299
|
+
],
|
|
300
|
+
...
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
```
|
|
304
|
+
|
|
268
305
|
## 🔐 Blocket API token
|
|
269
306
|
|
|
270
307
|
There are two ways to acquire your token:
|
|
@@ -289,5 +326,6 @@ My token has never expired or changed during this project. However, if your're m
|
|
|
289
326
|
|
|
290
327
|
## 📝 Notes
|
|
291
328
|
|
|
329
|
+
- REST API: https://blocket-api.se
|
|
292
330
|
- Source repo: https://github.com/dunderrrrrr/blocket_api
|
|
293
331
|
- PyPI: https://pypi.org/project/blocket-api/
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# BlocketAPI
|
|
2
2
|
|
|
3
|
-
[](https://pypi.org/project/blocket_api/) [](https://github.com/dunderrrrrr/blocket_api/blob/main/LICENSE)
|
|
3
|
+
[](https://pypi.org/project/blocket_api/) [](https://github.com/dunderrrrrr/blocket_api/blob/main/LICENSE)  
|
|
4
4
|
|
|
5
|
-
BlocketAPI allows users to query saved searches, known as "Bevakningar", on [blocket.se](https://blocket.se/). This means you can either retrieve results from a specific saved search or list all listings/ads across all saved searches. The results from these queries are returned in a `json` format.
|
|
5
|
+
BlocketAPI allows users to query saved searches, known as "Bevakningar", on [blocket.se](https://blocket.se/). This means you can either retrieve results from a specific saved search or list all listings/ads across all saved searches. The results from these queries are returned in a `json` format or as cleaned pydantic objects.
|
|
6
6
|
|
|
7
7
|
> Blocket is one of Sweden's largest online marketplaces. It was founded in 1996 and allows users to buy and sell a wide range of items, including cars, real estate, jobs, services, and second-hand goods. The platform is known for its extensive reach and user-friendly interface, making it a popular choice for Swedes looking to purchase or sell items quickly and efficiently.
|
|
8
8
|
|
|
@@ -17,12 +17,14 @@ BlocketAPI allows users to query saved searches, known as "Bevakningar", on [blo
|
|
|
17
17
|
|
|
18
18
|
## 🧑💻️ Install
|
|
19
19
|
|
|
20
|
-
BlocketAPI
|
|
20
|
+
Install BlocketAPI via PyPI...
|
|
21
21
|
|
|
22
22
|
```sh
|
|
23
23
|
pip install blocket-api
|
|
24
24
|
```
|
|
25
25
|
|
|
26
|
+
or use [blocket-api.se](https://blocket-api.se) without installing anything!
|
|
27
|
+
|
|
26
28
|
## 💁♀️ Usage
|
|
27
29
|
|
|
28
30
|
```py
|
|
@@ -39,20 +41,22 @@ Some calls require a `bearerToken`. However, some calls are public and don't req
|
|
|
39
41
|
[Where token?](#-blocket-api-token)
|
|
40
42
|
|
|
41
43
|
|
|
42
|
-
| Function | Token required | Description |
|
|
43
|
-
|
|
44
|
-
| [`api.saved_searches()`](#saved_searches) | 🔐 Yes | List your saved searches (bevakningar) |
|
|
45
|
-
| [`api.get_listings()`](#
|
|
46
|
-
| [`api.custom_search()`](#
|
|
47
|
-
| [`api.motor_search()`](#
|
|
48
|
-
| [`api.price_eval()`](#
|
|
49
|
-
| [`api.home_search()`](#
|
|
50
|
-
| [`api.store_search()`](#
|
|
51
|
-
| [`api.get_store_listings()`](#
|
|
44
|
+
| Function | Token required | `as_objects` | Description |
|
|
45
|
+
|---|---|---|---|
|
|
46
|
+
| [`api.saved_searches()`](#saved_searches) | 🔐 Yes | - | List your saved searches (bevakningar) |
|
|
47
|
+
| [`api.get_listings()`](#get_listings) | 🔐 Yes | - | List items related to a saved search |
|
|
48
|
+
| [`api.custom_search()`](#custom_search) | 👏 No | Yes | Search for everything on Blocket and filter by region |
|
|
49
|
+
| [`api.motor_search()`](#motor_search) | 👏 No | Yes | Advanced search for car-listings. |
|
|
50
|
+
| [`api.price_eval()`](#price_eval) | 👏 No | - | Vehicle purchase valuation and details. |
|
|
51
|
+
| [`api.home_search()`](#home_search) | 👏 No | Yes | Query home listings.
|
|
52
|
+
| [`api.store_search()`](#store_search) | 👏 No | Yes | Search for a store.
|
|
53
|
+
| [`api.get_store_listings()`](#get_store_listings) | 👏 No | Yes | Get listings from a specific store.
|
|
54
|
+
| [`api.get_ad_by_id()`](#get_ad_by_id) | 👏 No | Yes | Get ad data from id.
|
|
55
|
+
|
|
52
56
|
|
|
53
57
|
## 🤓 Detailed usage
|
|
54
58
|
|
|
55
|
-
### saved_searches
|
|
59
|
+
### saved_searches
|
|
56
60
|
|
|
57
61
|
Saved searches are your so called "Bevakningar" and can be found [here](https://www.blocket.se/sparade/bevakningar). Each saved search has and unique `id` which can be used as a parameter to `get_listings()`, see below.
|
|
58
62
|
|
|
@@ -71,7 +75,7 @@ Saved searches are your so called "Bevakningar" and can be found [here](https://
|
|
|
71
75
|
]
|
|
72
76
|
```
|
|
73
77
|
|
|
74
|
-
### get_listings
|
|
78
|
+
### get_listings
|
|
75
79
|
Returns all listings related to a saved search.
|
|
76
80
|
|
|
77
81
|
Parameters:
|
|
@@ -105,7 +109,7 @@ Parameters:
|
|
|
105
109
|
}
|
|
106
110
|
```
|
|
107
111
|
|
|
108
|
-
### custom_search
|
|
112
|
+
### custom_search
|
|
109
113
|
Make a custom search through out all of blocked. A region can be passed in as parameter for filtering.
|
|
110
114
|
|
|
111
115
|
Parameters:
|
|
@@ -113,9 +117,10 @@ Parameters:
|
|
|
113
117
|
- `region` (`enum`, optional) - Filter results on a region, default is all of Sweden.
|
|
114
118
|
- `category` (`enum`, optional) - Filter for a specific category, ex. `Category.for_hemmet`.
|
|
115
119
|
- `limit` (`int`, optional) - Limit number of results returned, max is 99.
|
|
120
|
+
- `as_objects` (`bool`, optional) - Return results as pydantic models, default is `False`.
|
|
116
121
|
|
|
117
122
|
```py
|
|
118
|
-
>>> from blocket_api import Region
|
|
123
|
+
>>> from blocket_api.blocket import Region, Category
|
|
119
124
|
>>> api.custom_search("saab", Region.blekinge) # search for term "saab" in region of "Blekinge"
|
|
120
125
|
{
|
|
121
126
|
"data":[
|
|
@@ -146,7 +151,7 @@ Parameters:
|
|
|
146
151
|
}
|
|
147
152
|
```
|
|
148
153
|
|
|
149
|
-
### motor_search
|
|
154
|
+
### motor_search
|
|
150
155
|
To query listings related to a specific car, supply the following parameters:
|
|
151
156
|
|
|
152
157
|
- `page` (`int`, required) - Results are split in pages, set page number here.
|
|
@@ -157,6 +162,8 @@ To query listings related to a specific car, supply the following parameters:
|
|
|
157
162
|
- `modelYear` (`Optional[Tuple[int, int]]`) - Set model year range, ex. `(2000, 2020)`.
|
|
158
163
|
- `milage` (`Optional[Tuple[int, int]]`) - Set milage range, ex. `(1000, 2000)`.
|
|
159
164
|
- `gearbox` (`Optional[GEARBOX_OPTIONS]`) - Filter a specific gearbox, ex. `Automat`.
|
|
165
|
+
- `as_objects` (`bool`, optional) - Return results as pydantic models, default is `False`.
|
|
166
|
+
|
|
160
167
|
```py
|
|
161
168
|
>>> api.motor_search(
|
|
162
169
|
make=["Audi", "Ford"],
|
|
@@ -168,7 +175,7 @@ To query listings related to a specific car, supply the following parameters:
|
|
|
168
175
|
...
|
|
169
176
|
```
|
|
170
177
|
|
|
171
|
-
### price_eval
|
|
178
|
+
### price_eval
|
|
172
179
|
Query price evaluation for a specific vehicle by using cars registration number (ABC123). This returns company and private estimated prices, car information, and more. The api queries same endpoint as Blockets ["värdera bil"](https://www.blocket.se/tjanster/vardera-bil) service.
|
|
173
180
|
|
|
174
181
|
- `registration_number` (`str`, required) - Registration number of the vehicle.
|
|
@@ -187,7 +194,7 @@ Query price evaluation for a specific vehicle by using cars registration number
|
|
|
187
194
|
}
|
|
188
195
|
```
|
|
189
196
|
|
|
190
|
-
### home_search
|
|
197
|
+
### home_search
|
|
191
198
|
Query home listings from [bostad.blocket.se](https://bostad.blocket.se/).
|
|
192
199
|
|
|
193
200
|
- `city` (`str`, required) - City name, ex. Stockholm.
|
|
@@ -195,6 +202,7 @@ Query home listings from [bostad.blocket.se](https://bostad.blocket.se/).
|
|
|
195
202
|
- `order_by` (`OrderBy`, optional) - Sorting order, ex. `OrderBy.price`.
|
|
196
203
|
- `ordering` (`HOME_SEARCH_ORDERING`, optional) - Sorting order, ex. `"descending"`.
|
|
197
204
|
- `offset` (`int`, optional) - Offset for results, ex. `60`.
|
|
205
|
+
- `as_objects` (`bool`, optional) - Return results as pydantic models, default is False.
|
|
198
206
|
|
|
199
207
|
```py
|
|
200
208
|
>>> from blocket_api.qasa import HomeType, OrderBy
|
|
@@ -207,11 +215,13 @@ Query home listings from [bostad.blocket.se](https://bostad.blocket.se/).
|
|
|
207
215
|
...
|
|
208
216
|
```
|
|
209
217
|
|
|
210
|
-
### store_search
|
|
218
|
+
### store_search
|
|
211
219
|
Search for a store in Blocket stores from [blocket.se/butiker](https://www.blocket.se/butiker).
|
|
212
220
|
|
|
213
221
|
- `search_query` (`str`, required) - The name of the store.
|
|
214
222
|
- `page` (`int`, optional) - The page number to return.
|
|
223
|
+
- `as_objects` (`bool`, optional) - Return results as pydantic models, default is `False`.
|
|
224
|
+
|
|
215
225
|
|
|
216
226
|
```py
|
|
217
227
|
>>> api.store_search("Jannes Car and Kebab")
|
|
@@ -227,11 +237,13 @@ Search for a store in Blocket stores from [blocket.se/butiker](https://www.block
|
|
|
227
237
|
}
|
|
228
238
|
```
|
|
229
239
|
|
|
230
|
-
### get_store_listings
|
|
240
|
+
### get_store_listings
|
|
231
241
|
Get listings from a specific store.
|
|
232
242
|
|
|
233
243
|
- `store_id` (`int`, required) - The store id. Can be obtained by calling `store_search()`.
|
|
234
244
|
- `page` (`int`, optional) - The page number to return.
|
|
245
|
+
- `as_objects` (`bool`, optional) - Return results as pydantic models, default is `False`.
|
|
246
|
+
|
|
235
247
|
|
|
236
248
|
```py
|
|
237
249
|
>>> api.get_store_listings(1234)
|
|
@@ -249,6 +261,30 @@ Get listings from a specific store.
|
|
|
249
261
|
}
|
|
250
262
|
```
|
|
251
263
|
|
|
264
|
+
### get_ad_by_id
|
|
265
|
+
Get ad data from a specific ad id.
|
|
266
|
+
|
|
267
|
+
- `ad_id` (`int`, required) - The ad id. Can be found by calling any other method or from ad url.
|
|
268
|
+
- `as_objects` (`bool`, optional) - Return results as pydantic models, default is `False`.
|
|
269
|
+
|
|
270
|
+
|
|
271
|
+
```py
|
|
272
|
+
>>> api.get_ad_by_id(1234)
|
|
273
|
+
{
|
|
274
|
+
"data": {
|
|
275
|
+
"ad_id": "1234",
|
|
276
|
+
"ad_status": "active",
|
|
277
|
+
"advertiser": {...},
|
|
278
|
+
"body": "A nice ad.",
|
|
279
|
+
"category": [
|
|
280
|
+
{"id": "4000", "name": "Personligt"},
|
|
281
|
+
{"id": "4080", "name": "Kläder & skor"},
|
|
282
|
+
],
|
|
283
|
+
...
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
```
|
|
287
|
+
|
|
252
288
|
## 🔐 Blocket API token
|
|
253
289
|
|
|
254
290
|
There are two ways to acquire your token:
|
|
@@ -273,5 +309,6 @@ My token has never expired or changed during this project. However, if your're m
|
|
|
273
309
|
|
|
274
310
|
## 📝 Notes
|
|
275
311
|
|
|
312
|
+
- REST API: https://blocket-api.se
|
|
276
313
|
- Source repo: https://github.com/dunderrrrrr/blocket_api
|
|
277
314
|
- PyPI: https://pypi.org/project/blocket-api/
|