blocket-api 0.3.7__tar.gz → 0.3.91__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.
@@ -0,0 +1,87 @@
1
+ Metadata-Version: 2.4
2
+ Name: blocket_api
3
+ Version: 0.3.91
4
+ Summary: A python API wrapper for blocket.se
5
+ Author-email: dunderrrrrr <emil.bjorkroth@gmail.com>
6
+ Requires-Python: >=3.10
7
+ Description-Content-Type: text/markdown
8
+ License-File: LICENSE
9
+ Requires-Dist: httpx>=0.28.1
10
+ Requires-Dist: pre-commit>=3.7.1
11
+ Requires-Dist: pytest>=8.2.2
12
+ Requires-Dist: respx>=0.21.1
13
+ Requires-Dist: mypy>=1.15.0
14
+ Requires-Dist: pydantic>=2.11.7
15
+ Requires-Dist: mkdocs>=1.6.1
16
+ Requires-Dist: mkdocs-material>=9.6.21
17
+ Requires-Dist: mkdocs-swagger-ui-tag>=0.7.2
18
+ Requires-Dist: websockets>=15.0.1
19
+ Requires-Dist: ruff>=0.14.5
20
+ Dynamic: license-file
21
+
22
+ <p align="center">
23
+ <img src="https://blocket-api.se/blocket-api.png" />
24
+ </p>
25
+
26
+ # BlocketAPI
27
+
28
+ [![PyPI version](https://img.shields.io/pypi/v/blocket_api?style=for-the-badge)](https://pypi.org/project/blocket_api/) [![License](https://img.shields.io/badge/license-WTFPL-green?style=for-the-badge)](https://github.com/dunderrrrrr/blocket_api/blob/main/LICENSE) ![Python](https://img.shields.io/badge/Python-3.10-blue?style=for-the-badge) ![PyPI - Downloads](https://img.shields.io/pypi/dw/blocket_api?style=for-the-badge&color=%23dbce58)
29
+
30
+ BlocketAPI allows users to search [blocket.se](https://blocket.se/) for ads.
31
+
32
+ > 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.
33
+
34
+ > [!NOTE]
35
+ > Blocket recently released a new version of their site which caused this package to break. But do not fear, we are actively working to try and restore all functionality. More info in [issue #43](https://github.com/dunderrrrrr/blocket_api/issues/41).
36
+
37
+ ## 🧑‍💻️ Install
38
+
39
+ Install BlocketAPI via PyPI...
40
+
41
+ ```sh
42
+ pip install blocket-api
43
+ ```
44
+
45
+ or use [blocket-api.se](https://blocket-api.se) without installing anything!
46
+
47
+ ## 💁‍♀️ Usage
48
+
49
+ ```py
50
+ from blocket_api import (
51
+ BlocketAPI,
52
+ Category,
53
+ CarColor,
54
+ CarModel,
55
+ CarSortOrder,
56
+ CarTransmission,
57
+ Location,
58
+ )
59
+
60
+ api = BlocketAPI()
61
+
62
+ # will search all of blocket
63
+ result = api.search(
64
+ "Vinterdäck Audi",
65
+ sort_order=SortOrder.PRICE_ASC,
66
+ locations=[Location.STOCKHOLM, Location.UPPSALA],
67
+ category=Category.FORDONSTILLBEHOR,
68
+ )
69
+
70
+ # search for cars only
71
+ result = api.search_car(
72
+ "Audi", # query is optional
73
+ sort_order=CarSortOrder.MILEAGE_ASC,
74
+ models=[CarModel.AUDI],
75
+ colors=[CarColor.GULD],
76
+ price_from=10000,
77
+ price_to=50000,
78
+ transmission=CarTransmission.MANUAL,
79
+ locations=[Location.STOCKHOLM],
80
+ )
81
+ ```
82
+
83
+ ## 📝 Notes
84
+
85
+ - REST API: https://blocket-api.se
86
+ - Source repo: https://github.com/dunderrrrrr/blocket_api
87
+ - PyPI: https://pypi.org/project/blocket-api/
@@ -0,0 +1,66 @@
1
+ <p align="center">
2
+ <img src="https://blocket-api.se/blocket-api.png" />
3
+ </p>
4
+
5
+ # BlocketAPI
6
+
7
+ [![PyPI version](https://img.shields.io/pypi/v/blocket_api?style=for-the-badge)](https://pypi.org/project/blocket_api/) [![License](https://img.shields.io/badge/license-WTFPL-green?style=for-the-badge)](https://github.com/dunderrrrrr/blocket_api/blob/main/LICENSE) ![Python](https://img.shields.io/badge/Python-3.10-blue?style=for-the-badge) ![PyPI - Downloads](https://img.shields.io/pypi/dw/blocket_api?style=for-the-badge&color=%23dbce58)
8
+
9
+ BlocketAPI allows users to search [blocket.se](https://blocket.se/) for ads.
10
+
11
+ > 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.
12
+
13
+ > [!NOTE]
14
+ > Blocket recently released a new version of their site which caused this package to break. But do not fear, we are actively working to try and restore all functionality. More info in [issue #43](https://github.com/dunderrrrrr/blocket_api/issues/41).
15
+
16
+ ## 🧑‍💻️ Install
17
+
18
+ Install BlocketAPI via PyPI...
19
+
20
+ ```sh
21
+ pip install blocket-api
22
+ ```
23
+
24
+ or use [blocket-api.se](https://blocket-api.se) without installing anything!
25
+
26
+ ## 💁‍♀️ Usage
27
+
28
+ ```py
29
+ from blocket_api import (
30
+ BlocketAPI,
31
+ Category,
32
+ CarColor,
33
+ CarModel,
34
+ CarSortOrder,
35
+ CarTransmission,
36
+ Location,
37
+ )
38
+
39
+ api = BlocketAPI()
40
+
41
+ # will search all of blocket
42
+ result = api.search(
43
+ "Vinterdäck Audi",
44
+ sort_order=SortOrder.PRICE_ASC,
45
+ locations=[Location.STOCKHOLM, Location.UPPSALA],
46
+ category=Category.FORDONSTILLBEHOR,
47
+ )
48
+
49
+ # search for cars only
50
+ result = api.search_car(
51
+ "Audi", # query is optional
52
+ sort_order=CarSortOrder.MILEAGE_ASC,
53
+ models=[CarModel.AUDI],
54
+ colors=[CarColor.GULD],
55
+ price_from=10000,
56
+ price_to=50000,
57
+ transmission=CarTransmission.MANUAL,
58
+ locations=[Location.STOCKHOLM],
59
+ )
60
+ ```
61
+
62
+ ## 📝 Notes
63
+
64
+ - REST API: https://blocket-api.se
65
+ - Source repo: https://github.com/dunderrrrrr/blocket_api
66
+ - PyPI: https://pypi.org/project/blocket-api/
@@ -0,0 +1,9 @@
1
+ from .blocket import BlocketAPI as BlocketAPI
2
+ from .blocket import Location as Location
3
+ from .constants import CarColor as CarColor
4
+ from .constants import CarModel as CarModel
5
+ from .constants import CarSortOrder as CarSortOrder
6
+ from .constants import CarTransmission as CarTransmission
7
+ from .constants import Category as Category
8
+ from .constants import SortOrder as SortOrder
9
+ from .constants import SubCategory as SubCategory
@@ -0,0 +1,98 @@
1
+ from __future__ import annotations
2
+
3
+ from dataclasses import dataclass
4
+ from typing import Any
5
+
6
+ import httpx
7
+
8
+ from .constants import (
9
+ HEADERS,
10
+ SITE_URL,
11
+ CarColor,
12
+ CarModel,
13
+ CarSortOrder,
14
+ Category,
15
+ Location,
16
+ SortOrder,
17
+ SubCategory,
18
+ )
19
+
20
+
21
+ @dataclass(frozen=True)
22
+ class QueryParam:
23
+ name: str
24
+ value: str | int
25
+
26
+
27
+ def _request(
28
+ *,
29
+ url: str,
30
+ params: list[QueryParam],
31
+ ) -> Any:
32
+ response = httpx.get(
33
+ url,
34
+ headers=HEADERS,
35
+ params=[(param.name, param.value) for param in params],
36
+ )
37
+ response.raise_for_status()
38
+ return response.json()
39
+
40
+
41
+ @dataclass(frozen=True)
42
+ class BlocketAPI:
43
+ def search(
44
+ self,
45
+ query: str,
46
+ *,
47
+ sort_order: SortOrder = SortOrder.RELEVANCE,
48
+ locations: list[Location] = [],
49
+ category: Category | None = None,
50
+ sub_category: SubCategory | None = None,
51
+ ) -> Any:
52
+ if category and sub_category:
53
+ raise AssertionError("Cannot specify both category and sub_categories")
54
+
55
+ url = f"{SITE_URL}/recommerce-search-page/api/search/SEARCH_ID_BAP_COMMON"
56
+ params = [
57
+ QueryParam("q", query),
58
+ QueryParam("sort", sort_order.value),
59
+ *[QueryParam("location", location.value) for location in locations],
60
+ *([QueryParam("category", category.value)] if category else []),
61
+ *([QueryParam("sub_category", sub_category.value)] if sub_category else []),
62
+ ]
63
+
64
+ return _request(url=url, params=params)
65
+
66
+ def search_car(
67
+ self,
68
+ query: str | None = None,
69
+ *,
70
+ sort_order: CarSortOrder = CarSortOrder.RELEVANCE,
71
+ locations: list[Location] = [],
72
+ models: list[CarModel] = [],
73
+ price_from: int | None = None,
74
+ price_to: int | None = None,
75
+ year_from: int | None = None,
76
+ year_to: int | None = None,
77
+ milage_from: int | None = None,
78
+ milage_to: int | None = None,
79
+ colors: list[CarColor] = [],
80
+ transmission: int | None = None,
81
+ ) -> Any:
82
+ url = f"{SITE_URL}/mobility/search/api/search/SEARCH_ID_CAR_USED"
83
+ params = [
84
+ *([QueryParam("q", query)] if query else []),
85
+ QueryParam("sort", sort_order.value),
86
+ *[QueryParam("location", location.value) for location in locations],
87
+ *[QueryParam("make", model.value) for model in models],
88
+ *([QueryParam("price_from", price_from)] if price_from else []),
89
+ *([QueryParam("price_to", price_to)] if price_to else []),
90
+ *([QueryParam("year_from", year_from)] if year_from else []),
91
+ *([QueryParam("year_to", year_to)] if year_to else []),
92
+ *([QueryParam("milage_from", milage_from)] if milage_from else []),
93
+ *([QueryParam("milage_to", milage_to)] if milage_to else []),
94
+ *[QueryParam("exterior_colour", color.value) for color in colors],
95
+ *([QueryParam("transmission", transmission)] if transmission else []),
96
+ ]
97
+
98
+ return _request(url=url, params=params)
@@ -0,0 +1,288 @@
1
+ from enum import IntEnum, StrEnum
2
+
3
+ SITE_URL = "https://www.blocket.se"
4
+ HEADERS = {
5
+ "User-Agent": "Mozilla/5.0 (X11; Linux x86_64; rv:128.0) Gecko/20100101 Firefox/128.0"
6
+ }
7
+
8
+
9
+ class SortOrder(StrEnum):
10
+ RELEVANCE = "RELEVANCE"
11
+ PRICE_DESC = "PRICE_DESC"
12
+ PRICE_ASC = "PRICE_ASC"
13
+ PUBLISHED_DESC = "PUBLISHED_DESC"
14
+ PUBLISHED_ASC = "PUBLISHED_ASC"
15
+
16
+
17
+ class CarSortOrder(StrEnum):
18
+ RELEVANCE = "RELEVANCE"
19
+ PRICE_DESC = "PRICE_DESC"
20
+ PRICE_ASC = "PRICE_ASC"
21
+ PUBLISHED_DESC = "PUBLISHED_DESC"
22
+ PUBLISHED_ASC = "PUBLISHED_ASC"
23
+
24
+ # Car specific
25
+ MILEAGE_DESC = "MILEAGE_DESC"
26
+ MILEAGE_ASC = "MILEAGE_ASC"
27
+ MODEL = "MODEL"
28
+ YEAR_DESC = "YEAR_DESC"
29
+ YEAR_ASC = "YEAR_ASC"
30
+
31
+
32
+ class Location(StrEnum):
33
+ BLEKINGE = "0.300010"
34
+ DALARNA = "0.300020"
35
+ GOTLAND = "0.300009"
36
+ GAVLEBORG = "0.300021"
37
+ HALLAND = "0.300013"
38
+ JAMTLAND = "0.300023"
39
+ JONKOPING = "0.300006"
40
+ KALMAR = "0.300008"
41
+ KRONOBERG = "0.300007"
42
+ NORRBOTTEN = "0.300025"
43
+ SKANE = "0.300012"
44
+ STOCKHOLM = "0.300001"
45
+ SODERMANLAND = "0.300004"
46
+ UPPSALA = "0.300003"
47
+ VARMLAND = "0.300017"
48
+ VASTERBOTTEN = "0.300024"
49
+ VASTERNORRLAND = "0.300022"
50
+ VASTMANLAND = "0.300019"
51
+ VASTRA_GÖTALAND = "0.300014"
52
+ OREBRO = "0.300018"
53
+ OSTERGOTLAND = "0.300005"
54
+
55
+
56
+ class Category(StrEnum):
57
+ AFFARSVERKSAMHET = "0.91"
58
+ # BIL_OCH_HUSVAGN = None
59
+ # BAT = None
60
+ DJUR_OCH_TILLBEHOR = "0.77"
61
+ ELEKTRONIK_OCH_VITVAROR = "0.93"
62
+ # ENTREPRENAD__OCH_LANTBRUKSMASKINER = None
63
+ FORDONSTILLBEHOR = "0.90"
64
+ FRITID_HOBBY_OCH_UNDERHALLNING = "0.86"
65
+ FORALDRAR_OCH_BARN = "0.68"
66
+ KLADER_KOSMETIKA_OCH_ACCESSOARER = "0.71"
67
+ KONST_OCH_ANTIKT = "0.76"
68
+ # MOTORCYKLAR = None
69
+ MOBLER_OCH_INREDNING = "0.78"
70
+ SPORT_OCH_FRITID = "0.69"
71
+ TRADGARD_OCH_RENOVERING = "0.67"
72
+
73
+
74
+ class SubCategory(StrEnum):
75
+ BYGGMATERIAL_OCH_RENOVERING = "1.67.3899"
76
+ BILDELAR_OCH_TILLBEHOR = "1.90.82"
77
+ CYKEL = "1.69.3963"
78
+ JAKT_FISKE_OCH_CAMPING = "1.69.3964"
79
+ TRADGARD_OCH_UTEMILJO = "1.67.3901"
80
+ MC_UTRUSTNING_OCH_RESERVDELAR = "1.90.20"
81
+ HUSVAGNS_OCH_HUSBILSDELAR = "1.90.70"
82
+ VERKTYG = "1.67.5219"
83
+ BUTIK_OCH_DETALJHANDEL = "1.91.3108"
84
+ CONTAINRAR_OCH_BARACKER = "1.91.3111"
85
+ DOMANER_OCH_SAJTER = "1.91.3106"
86
+ HALSA_OCH_FORSTA_HJALPEN = "1.91.8343"
87
+ JORDBRUK = "1.91.3114"
88
+ KONTORSUTRUSTNING_OCH_INREDNING = "1.91.3105"
89
+ LAST_OCH_TRANSPORT = "1.91.3113"
90
+ MASKINUTRUSTNING_OCH_RESERVDELAR = "1.91.3112"
91
+ SCEN = "1.91.3110"
92
+ STORKOK_OCH_RESTAURANG = "1.91.3103"
93
+ VERKSTAD_BYGG_OCH_KONSTRUKTION = "1.91.3102"
94
+ SLAP_OCH_TRAILER = "1.90.80"
95
+ BATDELAR_OCH_TILLBEHOR = "1.90.30"
96
+ AKVARIUM = "1.77.3976"
97
+ BURAR = "1.77.3977"
98
+ FISKAR = "1.77.5206"
99
+ FODER_DJURVARD_KENNLAR_OCH_STALL = "1.77.5186"
100
+ FAGLAR = "1.77.5205"
101
+ GNAGARE_OCH_KANINER = "1.77.5207"
102
+ HUNDAR = "1.77.5192"
103
+ HUNDTILLBEHOR = "1.77.5193"
104
+ HAST_OCH_RIDUTRUSTNING = "1.77.5195"
105
+ HASTAR = "1.77.5190"
106
+ KATTER = "1.77.5191"
107
+ KATTILLBEHOR = "1.77.5194"
108
+ LANTBRUKSDJUR = "1.77.9439"
109
+ REPTILER = "1.77.5210"
110
+ SPINDLAR_OCH_INSEKTER = "1.77.5208"
111
+ OVRIGA_DJUR = "1.77.5183"
112
+ OVRIGA_DJURTILLBEHOR = "1.77.5185"
113
+ DATORER = "1.93.3215"
114
+ FOTO_OCH_VIDEO = "1.93.3904"
115
+ HUSHALLSAPPARATER = "1.93.3216"
116
+ LJUD_OCH_BILD = "1.93.3906"
117
+ PERSONVARD = "1.93.9809"
118
+ TELEFONER_OCH_TILLBEHOR = "1.93.3217"
119
+ TV_SPEL_OCH_SPELKONSOLER = "1.93.3905"
120
+ VITVAROR = "1.93.3907"
121
+ ATV_RESERVDELAR = "1.90.3975"
122
+ OVRIGT = "1.90.3974"
123
+
124
+
125
+ class CarModel(StrEnum):
126
+ ABARTH = "0.8093"
127
+ AC = "0.200673"
128
+ ACURA = "0.200674"
129
+ AIWAYS = "0.200681"
130
+ ALFA_ROMEO = "0.3233"
131
+ ALPINA = "0.8092"
132
+ AMC = "0.8103"
133
+ ARIEL = "0.8110"
134
+ ARMSTRONG_SIDDELEY = "0.1156"
135
+ ASTON_MARTIN = "0.6733"
136
+ AUDI = "0.744"
137
+ AUSTIN = "0.8076"
138
+ AUSTIN_HEALEY = "0.200688"
139
+ AUTO_UNION = "0.200689"
140
+ AUTOBIANCHI = "0.200690"
141
+ BEDFORD = "0.200693"
142
+ BENTLEY = "0.7166"
143
+ BMW = "0.749"
144
+ BUGATTI = "0.8111"
145
+ BUICK = "0.750"
146
+ BYD = "0.8101"
147
+ CADILLAC = "0.752"
148
+ CATERHAM = "0.200704"
149
+ CHEVROLET = "0.753"
150
+ CHRYSLER = "0.754"
151
+ CITROEN = "0.757"
152
+ CUPRA = "0.8106"
153
+ DACIA = "0.8079"
154
+ DAEWOO = "0.760"
155
+ DAF = "0.8090"
156
+ DAIHATSU = "0.762"
157
+ DAIMLER = "0.200711"
158
+ DATSUN = "0.8089"
159
+ DE_TOMASO = "0.8069"
160
+ DELOREAN = "0.8085"
161
+ DESOTO = "0.200715"
162
+ DFSK = "0.2174"
163
+ DKW = "0.200718"
164
+ DODGE = "0.764"
165
+ DS = "0.8091"
166
+ EDSEL = "0.200723"
167
+ ERSKINE = "0.200726"
168
+ EXCALIBUR = "0.200727"
169
+ FERRARI = "0.2999"
170
+ FIAT = "0.766"
171
+ FISKER = "0.8073"
172
+ FORD = "0.767"
173
+ FORDSON = "0.200730"
174
+ GAZ = "0.200734"
175
+ GINETTA = "0.200738"
176
+ GMC = "0.7547"
177
+ HEINKEL = "0.200745"
178
+ HILLMAN = "0.200746"
179
+ HOLDEN = "0.200747"
180
+ HONDA = "0.771"
181
+ HONGQI = "0.8107"
182
+ HUDSON = "0.200748"
183
+ HUMBER = "0.200749"
184
+ HUMMER = "0.7672"
185
+ HYUNDAI = "0.772"
186
+ INEOS = "0.2000665"
187
+ INFINITI = "0.8065"
188
+ INTERNATIONAL = "0.1160"
189
+ ISUZU = "0.7179"
190
+ IVECO = "0.7280"
191
+ JAC = "0.8114"
192
+ JAGUAR = "0.775"
193
+ JEEP = "0.776"
194
+ JENSEN = "0.774"
195
+ KAISER_JEEP = "0.1162"
196
+ KGM = "0.2000649"
197
+ KIA = "0.777"
198
+ KTM = "0.200761"
199
+ LADA = "0.779"
200
+ LAMBORGHINI = "0.6731"
201
+ LANCIA = "0.780"
202
+ LAND_ROVER = "0.781"
203
+ LEVC = "0.200764"
204
+ LEXUS = "0.782"
205
+ LEYLAND = "0.200765"
206
+ LINCOLN = "0.7153"
207
+ LOTUS = "0.7191"
208
+ LYNK_CO = "0.200769"
209
+ MAN = "0.8097"
210
+ MASERATI = "0.3001"
211
+ MAXUS = "0.8096"
212
+ MAZDA = "0.784"
213
+ MCLAREN = "0.8087"
214
+ MERCEDES_BENZ = "0.785"
215
+ MERCURY = "0.7554"
216
+ MESSERSCHMITT = "0.200774"
217
+ MG = "0.786"
218
+ MINI = "0.7147"
219
+ MINI_MARCOS = "0.200775"
220
+ MITSUBISHI = "0.787"
221
+ MORGAN = "0.788"
222
+ MORRIS = "0.789"
223
+ NIO = "0.8109"
224
+ NISSAN = "0.792"
225
+ OLDSMOBILE = "0.794"
226
+ OPEL = "0.795"
227
+ PACKARD = "0.8077"
228
+ PEUGEOT = "0.796"
229
+ PLYMOUTH = "0.797"
230
+ POLESTAR = "0.8102"
231
+ PONTIAC = "0.800"
232
+ PORSCHE = "0.801"
233
+ PRO_SPORT = "0.200792"
234
+ RADICAL = "0.8088"
235
+ RAM = "0.8100"
236
+ RENAULT = "0.804"
237
+ ROLLS_ROYCE = "0.7170"
238
+ ROVER = "0.805"
239
+ SAAB = "0.806"
240
+ SCION = "0.822"
241
+ SEAT = "0.807"
242
+ SERES = "0.8108"
243
+ SHELBY = "0.1142"
244
+ SIMCA = "0.200807"
245
+ SKODA = "0.808"
246
+ SMART = "0.7137"
247
+ SSANGYONG = "0.7190"
248
+ STANDARD = "0.200812"
249
+ STUDEBAKER = "0.200815"
250
+ SUBARU = "0.810"
251
+ SUZUKI = "0.811"
252
+ TESLA = "0.8078"
253
+ TOYOTA = "0.813"
254
+ TRABANT = "0.200824"
255
+ TRIUMPH = "0.814"
256
+ TVR = "0.820"
257
+ VAUXHALL = "0.200827"
258
+ VOLKSWAGEN = "0.817"
259
+ VOLVO = "0.818"
260
+ WILLYS = "0.200834"
261
+ XPENG = "0.8104"
262
+ ZEEKR = "0.200841"
263
+ ZIMMER = "0.200844"
264
+ OVRIGA = "0.2252"
265
+
266
+
267
+ class CarColor(IntEnum):
268
+ BEIGE = 1
269
+ BLA = 2
270
+ BRONS = 3
271
+ BRUN = 4
272
+ GRA = 6
273
+ GRON = 5
274
+ GUL = 7
275
+ GULD = 8
276
+ VIT = 9
277
+ LILA = 10
278
+ ORANGE = 11
279
+ ROSA = 12
280
+ ROD = 13
281
+ SILVER = 15
282
+ SVART = 14
283
+ TURKOS = 16
284
+
285
+
286
+ class CarTransmission(IntEnum):
287
+ AUTOMATIC = 2
288
+ MANUAL = 1
@@ -0,0 +1,87 @@
1
+ Metadata-Version: 2.4
2
+ Name: blocket_api
3
+ Version: 0.3.91
4
+ Summary: A python API wrapper for blocket.se
5
+ Author-email: dunderrrrrr <emil.bjorkroth@gmail.com>
6
+ Requires-Python: >=3.10
7
+ Description-Content-Type: text/markdown
8
+ License-File: LICENSE
9
+ Requires-Dist: httpx>=0.28.1
10
+ Requires-Dist: pre-commit>=3.7.1
11
+ Requires-Dist: pytest>=8.2.2
12
+ Requires-Dist: respx>=0.21.1
13
+ Requires-Dist: mypy>=1.15.0
14
+ Requires-Dist: pydantic>=2.11.7
15
+ Requires-Dist: mkdocs>=1.6.1
16
+ Requires-Dist: mkdocs-material>=9.6.21
17
+ Requires-Dist: mkdocs-swagger-ui-tag>=0.7.2
18
+ Requires-Dist: websockets>=15.0.1
19
+ Requires-Dist: ruff>=0.14.5
20
+ Dynamic: license-file
21
+
22
+ <p align="center">
23
+ <img src="https://blocket-api.se/blocket-api.png" />
24
+ </p>
25
+
26
+ # BlocketAPI
27
+
28
+ [![PyPI version](https://img.shields.io/pypi/v/blocket_api?style=for-the-badge)](https://pypi.org/project/blocket_api/) [![License](https://img.shields.io/badge/license-WTFPL-green?style=for-the-badge)](https://github.com/dunderrrrrr/blocket_api/blob/main/LICENSE) ![Python](https://img.shields.io/badge/Python-3.10-blue?style=for-the-badge) ![PyPI - Downloads](https://img.shields.io/pypi/dw/blocket_api?style=for-the-badge&color=%23dbce58)
29
+
30
+ BlocketAPI allows users to search [blocket.se](https://blocket.se/) for ads.
31
+
32
+ > 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.
33
+
34
+ > [!NOTE]
35
+ > Blocket recently released a new version of their site which caused this package to break. But do not fear, we are actively working to try and restore all functionality. More info in [issue #43](https://github.com/dunderrrrrr/blocket_api/issues/41).
36
+
37
+ ## 🧑‍💻️ Install
38
+
39
+ Install BlocketAPI via PyPI...
40
+
41
+ ```sh
42
+ pip install blocket-api
43
+ ```
44
+
45
+ or use [blocket-api.se](https://blocket-api.se) without installing anything!
46
+
47
+ ## 💁‍♀️ Usage
48
+
49
+ ```py
50
+ from blocket_api import (
51
+ BlocketAPI,
52
+ Category,
53
+ CarColor,
54
+ CarModel,
55
+ CarSortOrder,
56
+ CarTransmission,
57
+ Location,
58
+ )
59
+
60
+ api = BlocketAPI()
61
+
62
+ # will search all of blocket
63
+ result = api.search(
64
+ "Vinterdäck Audi",
65
+ sort_order=SortOrder.PRICE_ASC,
66
+ locations=[Location.STOCKHOLM, Location.UPPSALA],
67
+ category=Category.FORDONSTILLBEHOR,
68
+ )
69
+
70
+ # search for cars only
71
+ result = api.search_car(
72
+ "Audi", # query is optional
73
+ sort_order=CarSortOrder.MILEAGE_ASC,
74
+ models=[CarModel.AUDI],
75
+ colors=[CarColor.GULD],
76
+ price_from=10000,
77
+ price_to=50000,
78
+ transmission=CarTransmission.MANUAL,
79
+ locations=[Location.STOCKHOLM],
80
+ )
81
+ ```
82
+
83
+ ## 📝 Notes
84
+
85
+ - REST API: https://blocket-api.se
86
+ - Source repo: https://github.com/dunderrrrrr/blocket_api
87
+ - PyPI: https://pypi.org/project/blocket-api/
@@ -4,10 +4,6 @@ pyproject.toml
4
4
  blocket_api/__init__.py
5
5
  blocket_api/blocket.py
6
6
  blocket_api/constants.py
7
- blocket_api/decorators.py
8
- blocket_api/models.py
9
- blocket_api/qasa.py
10
- blocket_api/sendbird.py
11
7
  blocket_api.egg-info/PKG-INFO
12
8
  blocket_api.egg-info/SOURCES.txt
13
9
  blocket_api.egg-info/dependency_links.txt
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "blocket_api"
3
- version = "0.3.7"
3
+ version = "0.3.91"
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"