blocket-api 0.2.7__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: blocket_api
3
- Version: 0.2.7
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
@@ -11,7 +11,7 @@ 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: ruff>=0.12.3
14
+ Requires-Dist: ruff>=0.12.4
15
15
  Dynamic: license-file
16
16
 
17
17
  # BlocketAPI
@@ -27,9 +27,9 @@ BlocketAPI allows users to query saved searches, known as "Bevakningar", on [blo
27
27
  - List saved searches, called "Bevakningar".
28
28
  - Get listings from all or a specific saved search.
29
29
  - Search for anything on Blocket with filters for region and category.
30
- - Advanced search for vehicles with multiple filters.
31
- - Get vehicle information and price evaluation.
30
+ - Get vehicle information, price evaluation and search for vehicles with multiple filters.
32
31
  - Search for homes with filters for city, home type and more.
32
+ - Search for stores and get a specific store's listings.
33
33
 
34
34
  ## 🧑‍💻️ Install
35
35
 
@@ -50,7 +50,7 @@ pip install blocket-api
50
50
  ...
51
51
  ```
52
52
 
53
- Some calls require a bearerToken. However, some calls are public and don't require a token.
53
+ Some calls require a `bearerToken`. However, some calls are public and don't require a token.
54
54
 
55
55
  [Where token?](#-blocket-api-token)
56
56
 
@@ -63,6 +63,8 @@ Some calls require a bearerToken. However, some calls are public and don't requi
63
63
  | [`api.motor_search()`](#motor_searchpage-make-fuel-chassi-price-modelyear-milage-gearbox) | 👏 No | Advanced search for car-listings. |
64
64
  | [`api.price_eval()`](#price_evalregistration_number) | 👏 No | Vehicle purchase valuation and details. |
65
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.
66
68
 
67
69
  ## 🤓 Detailed usage
68
70
 
@@ -221,6 +223,48 @@ Query home listings from [bostad.blocket.se](https://bostad.blocket.se/).
221
223
  ...
222
224
  ```
223
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
+
224
268
  ## 🔐 Blocket API token
225
269
 
226
270
  There are two ways to acquire your token:
@@ -11,9 +11,9 @@ BlocketAPI allows users to query saved searches, known as "Bevakningar", on [blo
11
11
  - List saved searches, called "Bevakningar".
12
12
  - Get listings from all or a specific saved search.
13
13
  - Search for anything on Blocket with filters for region and category.
14
- - Advanced search for vehicles with multiple filters.
15
- - Get vehicle information and price evaluation.
14
+ - Get vehicle information, price evaluation and search for vehicles with multiple filters.
16
15
  - Search for homes with filters for city, home type and more.
16
+ - Search for stores and get a specific store's listings.
17
17
 
18
18
  ## 🧑‍💻️ Install
19
19
 
@@ -34,7 +34,7 @@ pip install blocket-api
34
34
  ...
35
35
  ```
36
36
 
37
- Some calls require a bearerToken. However, some calls are public and don't require a token.
37
+ Some calls require a `bearerToken`. However, some calls are public and don't require a token.
38
38
 
39
39
  [Where token?](#-blocket-api-token)
40
40
 
@@ -47,6 +47,8 @@ Some calls require a bearerToken. However, some calls are public and don't requi
47
47
  | [`api.motor_search()`](#motor_searchpage-make-fuel-chassi-price-modelyear-milage-gearbox) | 👏 No | Advanced search for car-listings. |
48
48
  | [`api.price_eval()`](#price_evalregistration_number) | 👏 No | Vehicle purchase valuation and details. |
49
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.
50
52
 
51
53
  ## 🤓 Detailed usage
52
54
 
@@ -205,6 +207,48 @@ Query home listings from [bostad.blocket.se](https://bostad.blocket.se/).
205
207
  ...
206
208
  ```
207
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
+
208
252
  ## 🔐 Blocket API token
209
253
 
210
254
  There are two ways to acquire your token:
@@ -334,3 +334,32 @@ class BlocketAPI:
334
334
  ordering=ordering,
335
335
  offset=offset,
336
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.7
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
@@ -11,7 +11,7 @@ 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: ruff>=0.12.3
14
+ Requires-Dist: ruff>=0.12.4
15
15
  Dynamic: license-file
16
16
 
17
17
  # BlocketAPI
@@ -27,9 +27,9 @@ BlocketAPI allows users to query saved searches, known as "Bevakningar", on [blo
27
27
  - List saved searches, called "Bevakningar".
28
28
  - Get listings from all or a specific saved search.
29
29
  - Search for anything on Blocket with filters for region and category.
30
- - Advanced search for vehicles with multiple filters.
31
- - Get vehicle information and price evaluation.
30
+ - Get vehicle information, price evaluation and search for vehicles with multiple filters.
32
31
  - Search for homes with filters for city, home type and more.
32
+ - Search for stores and get a specific store's listings.
33
33
 
34
34
  ## 🧑‍💻️ Install
35
35
 
@@ -50,7 +50,7 @@ pip install blocket-api
50
50
  ...
51
51
  ```
52
52
 
53
- Some calls require a bearerToken. However, some calls are public and don't require a token.
53
+ Some calls require a `bearerToken`. However, some calls are public and don't require a token.
54
54
 
55
55
  [Where token?](#-blocket-api-token)
56
56
 
@@ -63,6 +63,8 @@ Some calls require a bearerToken. However, some calls are public and don't requi
63
63
  | [`api.motor_search()`](#motor_searchpage-make-fuel-chassi-price-modelyear-milage-gearbox) | 👏 No | Advanced search for car-listings. |
64
64
  | [`api.price_eval()`](#price_evalregistration_number) | 👏 No | Vehicle purchase valuation and details. |
65
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.
66
68
 
67
69
  ## 🤓 Detailed usage
68
70
 
@@ -221,6 +223,48 @@ Query home listings from [bostad.blocket.se](https://bostad.blocket.se/).
221
223
  ...
222
224
  ```
223
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
+
224
268
  ## 🔐 Blocket API token
225
269
 
226
270
  There are two ways to acquire your token:
@@ -3,4 +3,4 @@ pre-commit>=3.7.1
3
3
  pytest>=8.2.2
4
4
  respx>=0.21.1
5
5
  mypy>=1.15.0
6
- ruff>=0.12.3
6
+ ruff>=0.12.4
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "blocket_api"
3
- version = "0.2.7"
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"
@@ -11,7 +11,7 @@ dependencies = [
11
11
  "pytest>=8.2.2",
12
12
  "respx>=0.21.1",
13
13
  "mypy>=1.15.0",
14
- "ruff>=0.12.3",
14
+ "ruff>=0.12.4",
15
15
  ]
16
16
 
17
17
 
File without changes
File without changes