blocket-api 0.5.2__tar.gz → 0.5.4__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.5.2 → blocket_api-0.5.4}/PKG-INFO +13 -10
- {blocket_api-0.5.2 → blocket_api-0.5.4}/README.md +4 -1
- {blocket_api-0.5.2 → blocket_api-0.5.4}/blocket_api/__init__.py +8 -6
- {blocket_api-0.5.2 → blocket_api-0.5.4}/blocket_api/_params.py +3 -0
- {blocket_api-0.5.2 → blocket_api-0.5.4}/blocket_api/ad_parser.py +4 -5
- {blocket_api-0.5.2 → blocket_api-0.5.4}/blocket_api/async_blocket.py +4 -3
- {blocket_api-0.5.2 → blocket_api-0.5.4}/blocket_api/blocket.py +3 -2
- {blocket_api-0.5.2 → blocket_api-0.5.4}/blocket_api/constants.py +11 -0
- {blocket_api-0.5.2 → blocket_api-0.5.4}/blocket_api.egg-info/PKG-INFO +13 -10
- blocket_api-0.5.4/blocket_api.egg-info/requires.txt +13 -0
- {blocket_api-0.5.2 → blocket_api-0.5.4}/pyproject.toml +12 -9
- blocket_api-0.5.2/blocket_api.egg-info/requires.txt +0 -13
- {blocket_api-0.5.2 → blocket_api-0.5.4}/LICENSE +0 -0
- {blocket_api-0.5.2 → blocket_api-0.5.4}/blocket_api.egg-info/SOURCES.txt +0 -0
- {blocket_api-0.5.2 → blocket_api-0.5.4}/blocket_api.egg-info/dependency_links.txt +0 -0
- {blocket_api-0.5.2 → blocket_api-0.5.4}/blocket_api.egg-info/top_level.txt +0 -0
- {blocket_api-0.5.2 → blocket_api-0.5.4}/setup.cfg +0 -0
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: blocket_api
|
|
3
|
-
Version: 0.5.
|
|
3
|
+
Version: 0.5.4
|
|
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
|
|
7
7
|
Description-Content-Type: text/markdown
|
|
8
8
|
License-File: LICENSE
|
|
9
9
|
Requires-Dist: httpx>=0.28.1
|
|
10
|
-
Requires-Dist: beautifulsoup4>=4.
|
|
10
|
+
Requires-Dist: beautifulsoup4>=4.15.0
|
|
11
11
|
Provides-Extra: dev
|
|
12
|
-
Requires-Dist: pre-commit>=4.
|
|
13
|
-
Requires-Dist: pytest>=9.
|
|
14
|
-
Requires-Dist: pytest-asyncio>=
|
|
15
|
-
Requires-Dist: respx>=0.
|
|
16
|
-
Requires-Dist: mypy>=
|
|
17
|
-
Requires-Dist: ruff>=0.
|
|
12
|
+
Requires-Dist: pre-commit>=4.6.2; extra == "dev"
|
|
13
|
+
Requires-Dist: pytest>=9.1.1; extra == "dev"
|
|
14
|
+
Requires-Dist: pytest-asyncio>=1.4.0; extra == "dev"
|
|
15
|
+
Requires-Dist: respx>=0.23.1; extra == "dev"
|
|
16
|
+
Requires-Dist: mypy>=2.3.1; extra == "dev"
|
|
17
|
+
Requires-Dist: ruff>=0.16.6; extra == "dev"
|
|
18
18
|
Requires-Dist: flask>=3.1.3; extra == "dev"
|
|
19
19
|
Requires-Dist: htpy>=26.5.1; extra == "dev"
|
|
20
|
-
Requires-Dist: gunicorn>=26.
|
|
20
|
+
Requires-Dist: gunicorn>=26.2.0; extra == "dev"
|
|
21
21
|
Dynamic: license-file
|
|
22
22
|
|
|
23
23
|
# BlocketAPI
|
|
@@ -26,7 +26,7 @@ Dynamic: license-file
|
|
|
26
26
|
|
|
27
27
|
BlocketAPI allows users to search [blocket.se](https://blocket.se/) for ads.
|
|
28
28
|
|
|
29
|
-
> 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
|
|
29
|
+
> 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.
|
|
30
30
|
|
|
31
31
|
## 🧑💻️ Install
|
|
32
32
|
|
|
@@ -48,6 +48,7 @@ from blocket_api import (
|
|
|
48
48
|
BlocketAPI,
|
|
49
49
|
Category,
|
|
50
50
|
CarColor,
|
|
51
|
+
CarFuel,
|
|
51
52
|
CarModel,
|
|
52
53
|
CarSortOrder,
|
|
53
54
|
CarTransmission,
|
|
@@ -74,6 +75,7 @@ api.search_car(
|
|
|
74
75
|
price_from=10000,
|
|
75
76
|
price_to=50000,
|
|
76
77
|
transmissions=[CarTransmission.MANUAL],
|
|
78
|
+
fuels=[CarFuel.DIESEL],
|
|
77
79
|
wheel_drive=[CarWheelDrive.RWD],
|
|
78
80
|
locations=[Location.STOCKHOLM],
|
|
79
81
|
horsepower_from=200,
|
|
@@ -136,5 +138,6 @@ asyncio.run(main())
|
|
|
136
138
|
## 📝 Notes
|
|
137
139
|
|
|
138
140
|
- REST API: https://blocket-api.se
|
|
141
|
+
- Webhooks: https://webhooks.blocket-api.se
|
|
139
142
|
- Source repo: https://github.com/dunderrrrrr/blocket_api
|
|
140
143
|
- PyPI: https://pypi.org/project/blocket-api/
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
BlocketAPI allows users to search [blocket.se](https://blocket.se/) for ads.
|
|
6
6
|
|
|
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
|
|
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
|
|
|
9
9
|
## 🧑💻️ Install
|
|
10
10
|
|
|
@@ -26,6 +26,7 @@ from blocket_api import (
|
|
|
26
26
|
BlocketAPI,
|
|
27
27
|
Category,
|
|
28
28
|
CarColor,
|
|
29
|
+
CarFuel,
|
|
29
30
|
CarModel,
|
|
30
31
|
CarSortOrder,
|
|
31
32
|
CarTransmission,
|
|
@@ -52,6 +53,7 @@ api.search_car(
|
|
|
52
53
|
price_from=10000,
|
|
53
54
|
price_to=50000,
|
|
54
55
|
transmissions=[CarTransmission.MANUAL],
|
|
56
|
+
fuels=[CarFuel.DIESEL],
|
|
55
57
|
wheel_drive=[CarWheelDrive.RWD],
|
|
56
58
|
locations=[Location.STOCKHOLM],
|
|
57
59
|
horsepower_from=200,
|
|
@@ -114,5 +116,6 @@ asyncio.run(main())
|
|
|
114
116
|
## 📝 Notes
|
|
115
117
|
|
|
116
118
|
- REST API: https://blocket-api.se
|
|
119
|
+
- Webhooks: https://webhooks.blocket-api.se
|
|
117
120
|
- Source repo: https://github.com/dunderrrrrr/blocket_api
|
|
118
121
|
- PyPI: https://pypi.org/project/blocket-api/
|
|
@@ -5,6 +5,7 @@ from .constants import (
|
|
|
5
5
|
BoatSortOrder,
|
|
6
6
|
BoatType,
|
|
7
7
|
CarColor,
|
|
8
|
+
CarFuel,
|
|
8
9
|
CarModel,
|
|
9
10
|
CarSortOrder,
|
|
10
11
|
CarTransmission,
|
|
@@ -20,22 +21,23 @@ from .constants import (
|
|
|
20
21
|
__all__ = [
|
|
21
22
|
"AsyncBlocketAPI",
|
|
22
23
|
"BlocketAPI",
|
|
23
|
-
"Location",
|
|
24
24
|
"BoatAd",
|
|
25
|
-
"CarAd",
|
|
26
25
|
"BoatSortOrder",
|
|
27
26
|
"BoatType",
|
|
27
|
+
"CarAd",
|
|
28
28
|
"CarColor",
|
|
29
|
+
"CarFuel",
|
|
29
30
|
"CarModel",
|
|
30
31
|
"CarSortOrder",
|
|
31
32
|
"CarTransmission",
|
|
32
33
|
"CarWheelDrive",
|
|
33
34
|
"Category",
|
|
34
|
-
"
|
|
35
|
-
"
|
|
36
|
-
"RecommerceAd",
|
|
35
|
+
"Location",
|
|
36
|
+
"McAd",
|
|
37
37
|
"McModel",
|
|
38
38
|
"McSortOrder",
|
|
39
39
|
"McType",
|
|
40
|
-
"
|
|
40
|
+
"RecommerceAd",
|
|
41
|
+
"SortOrder",
|
|
42
|
+
"SubCategory",
|
|
41
43
|
]
|
|
@@ -5,6 +5,7 @@ from collections.abc import Sequence
|
|
|
5
5
|
from .constants import (
|
|
6
6
|
BoatType,
|
|
7
7
|
CarColor,
|
|
8
|
+
CarFuel,
|
|
8
9
|
CarModel,
|
|
9
10
|
CarSortOrder,
|
|
10
11
|
CarTransmission,
|
|
@@ -72,6 +73,7 @@ def build_car_params(
|
|
|
72
73
|
milage_to: int | None = None,
|
|
73
74
|
colors: list[CarColor] = [],
|
|
74
75
|
transmissions: list[CarTransmission] = [],
|
|
76
|
+
fuels: list[CarFuel] = [],
|
|
75
77
|
horsepower_from: int | None = None,
|
|
76
78
|
horsepower_to: int | None = None,
|
|
77
79
|
wheel_drive: list[CarWheelDrive] = [],
|
|
@@ -97,6 +99,7 @@ def build_car_params(
|
|
|
97
99
|
extras.extend(("make", model.value) for model in models)
|
|
98
100
|
extras.extend(("exterior_colour", color.value) for color in colors)
|
|
99
101
|
extras.extend(("transmission", t.value) for t in transmissions)
|
|
102
|
+
extras.extend(("fuel", f.value) for f in fuels)
|
|
100
103
|
extras.extend(("wheel_drive", w.value) for w in wheel_drive)
|
|
101
104
|
|
|
102
105
|
return _build_params(defaults, extras)
|
|
@@ -100,7 +100,7 @@ class MobilityAd:
|
|
|
100
100
|
return
|
|
101
101
|
|
|
102
102
|
def _extract_specifications(self, grid: Tag, data: dict) -> None:
|
|
103
|
-
specs_section = grid.find("section", class_="key-info
|
|
103
|
+
specs_section = grid.find("section", class_=lambda x: x and "key-info" in x)
|
|
104
104
|
if not specs_section:
|
|
105
105
|
return
|
|
106
106
|
dl = specs_section.find("dl")
|
|
@@ -108,9 +108,8 @@ class MobilityAd:
|
|
|
108
108
|
return
|
|
109
109
|
|
|
110
110
|
specifications = {}
|
|
111
|
-
for
|
|
112
|
-
|
|
113
|
-
dd = div.find("dd")
|
|
111
|
+
for dt in dl.find_all("dt"):
|
|
112
|
+
dd = dt.find_next_sibling("dd")
|
|
114
113
|
if dt and dd:
|
|
115
114
|
specifications[dt.get_text(strip=True)] = dd.get_text(strip=True)
|
|
116
115
|
|
|
@@ -193,7 +192,7 @@ class McAd(MobilityAd):
|
|
|
193
192
|
|
|
194
193
|
def extend(self, data: dict, soup: BeautifulSoup, grid: Tag) -> None:
|
|
195
194
|
if place_h2 := soup.find(
|
|
196
|
-
"h2",
|
|
195
|
+
"h2", string=lambda t: isinstance(t, NavigableString) and "Plats" in t
|
|
197
196
|
):
|
|
198
197
|
if link := place_h2.find_parent():
|
|
199
198
|
data["location"] = link.get_text(strip=True)
|
|
@@ -17,10 +17,9 @@ from .constants import (
|
|
|
17
17
|
HEADERS,
|
|
18
18
|
MC_SEARCH_URL,
|
|
19
19
|
SEARCH_URL,
|
|
20
|
-
)
|
|
21
|
-
from .constants import (
|
|
22
20
|
BoatType,
|
|
23
21
|
CarColor,
|
|
22
|
+
CarFuel,
|
|
24
23
|
CarModel,
|
|
25
24
|
CarSortOrder,
|
|
26
25
|
CarTransmission,
|
|
@@ -43,7 +42,7 @@ class AsyncBlocketAPI:
|
|
|
43
42
|
async def __aenter__(self) -> AsyncBlocketAPI:
|
|
44
43
|
return self
|
|
45
44
|
|
|
46
|
-
async def __aexit__(self, *_:
|
|
45
|
+
async def __aexit__(self, *_: object) -> None:
|
|
47
46
|
await self.aclose()
|
|
48
47
|
|
|
49
48
|
async def aclose(self) -> None:
|
|
@@ -87,6 +86,7 @@ class AsyncBlocketAPI:
|
|
|
87
86
|
milage_to: int | None = None,
|
|
88
87
|
colors: list[CarColor] = [],
|
|
89
88
|
transmissions: list[CarTransmission] = [],
|
|
89
|
+
fuels: list[CarFuel] = [],
|
|
90
90
|
horsepower_from: int | None = None,
|
|
91
91
|
horsepower_to: int | None = None,
|
|
92
92
|
wheel_drive: list[CarWheelDrive] = [],
|
|
@@ -106,6 +106,7 @@ class AsyncBlocketAPI:
|
|
|
106
106
|
milage_to=milage_to,
|
|
107
107
|
colors=colors,
|
|
108
108
|
transmissions=transmissions,
|
|
109
|
+
fuels=fuels,
|
|
109
110
|
horsepower_from=horsepower_from,
|
|
110
111
|
horsepower_to=horsepower_to,
|
|
111
112
|
wheel_drive=wheel_drive,
|
|
@@ -18,10 +18,9 @@ from .constants import (
|
|
|
18
18
|
HEADERS,
|
|
19
19
|
MC_SEARCH_URL,
|
|
20
20
|
SEARCH_URL,
|
|
21
|
-
)
|
|
22
|
-
from .constants import (
|
|
23
21
|
BoatType,
|
|
24
22
|
CarColor,
|
|
23
|
+
CarFuel,
|
|
25
24
|
CarModel,
|
|
26
25
|
CarSortOrder,
|
|
27
26
|
CarTransmission,
|
|
@@ -79,6 +78,7 @@ class BlocketAPI:
|
|
|
79
78
|
milage_to: int | None = None,
|
|
80
79
|
colors: list[CarColor] = [],
|
|
81
80
|
transmissions: list[CarTransmission] = [],
|
|
81
|
+
fuels: list[CarFuel] = [],
|
|
82
82
|
horsepower_from: int | None = None,
|
|
83
83
|
horsepower_to: int | None = None,
|
|
84
84
|
wheel_drive: list[CarWheelDrive] = [],
|
|
@@ -98,6 +98,7 @@ class BlocketAPI:
|
|
|
98
98
|
milage_to=milage_to,
|
|
99
99
|
colors=colors,
|
|
100
100
|
transmissions=transmissions,
|
|
101
|
+
fuels=fuels,
|
|
101
102
|
horsepower_from=horsepower_from,
|
|
102
103
|
horsepower_to=horsepower_to,
|
|
103
104
|
wheel_drive=wheel_drive,
|
|
@@ -386,6 +386,17 @@ class CarTransmission(IntEnum):
|
|
|
386
386
|
MANUAL = 1
|
|
387
387
|
|
|
388
388
|
|
|
389
|
+
class CarFuel(IntEnum):
|
|
390
|
+
BENSIN = 1
|
|
391
|
+
DIESEL = 2
|
|
392
|
+
FORDONSGAS = 3
|
|
393
|
+
EL = 4
|
|
394
|
+
HYBRID_GAS = 5
|
|
395
|
+
HYBRID_BENSIN = 6
|
|
396
|
+
HYBRID_DIESEL = 8
|
|
397
|
+
VATGAS = 9
|
|
398
|
+
|
|
399
|
+
|
|
389
400
|
class CarWheelDrive(IntEnum):
|
|
390
401
|
FWD = 3
|
|
391
402
|
RWD = 1
|
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: blocket_api
|
|
3
|
-
Version: 0.5.
|
|
3
|
+
Version: 0.5.4
|
|
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
|
|
7
7
|
Description-Content-Type: text/markdown
|
|
8
8
|
License-File: LICENSE
|
|
9
9
|
Requires-Dist: httpx>=0.28.1
|
|
10
|
-
Requires-Dist: beautifulsoup4>=4.
|
|
10
|
+
Requires-Dist: beautifulsoup4>=4.15.0
|
|
11
11
|
Provides-Extra: dev
|
|
12
|
-
Requires-Dist: pre-commit>=4.
|
|
13
|
-
Requires-Dist: pytest>=9.
|
|
14
|
-
Requires-Dist: pytest-asyncio>=
|
|
15
|
-
Requires-Dist: respx>=0.
|
|
16
|
-
Requires-Dist: mypy>=
|
|
17
|
-
Requires-Dist: ruff>=0.
|
|
12
|
+
Requires-Dist: pre-commit>=4.6.2; extra == "dev"
|
|
13
|
+
Requires-Dist: pytest>=9.1.1; extra == "dev"
|
|
14
|
+
Requires-Dist: pytest-asyncio>=1.4.0; extra == "dev"
|
|
15
|
+
Requires-Dist: respx>=0.23.1; extra == "dev"
|
|
16
|
+
Requires-Dist: mypy>=2.3.1; extra == "dev"
|
|
17
|
+
Requires-Dist: ruff>=0.16.6; extra == "dev"
|
|
18
18
|
Requires-Dist: flask>=3.1.3; extra == "dev"
|
|
19
19
|
Requires-Dist: htpy>=26.5.1; extra == "dev"
|
|
20
|
-
Requires-Dist: gunicorn>=26.
|
|
20
|
+
Requires-Dist: gunicorn>=26.2.0; extra == "dev"
|
|
21
21
|
Dynamic: license-file
|
|
22
22
|
|
|
23
23
|
# BlocketAPI
|
|
@@ -26,7 +26,7 @@ Dynamic: license-file
|
|
|
26
26
|
|
|
27
27
|
BlocketAPI allows users to search [blocket.se](https://blocket.se/) for ads.
|
|
28
28
|
|
|
29
|
-
> 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
|
|
29
|
+
> 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.
|
|
30
30
|
|
|
31
31
|
## 🧑💻️ Install
|
|
32
32
|
|
|
@@ -48,6 +48,7 @@ from blocket_api import (
|
|
|
48
48
|
BlocketAPI,
|
|
49
49
|
Category,
|
|
50
50
|
CarColor,
|
|
51
|
+
CarFuel,
|
|
51
52
|
CarModel,
|
|
52
53
|
CarSortOrder,
|
|
53
54
|
CarTransmission,
|
|
@@ -74,6 +75,7 @@ api.search_car(
|
|
|
74
75
|
price_from=10000,
|
|
75
76
|
price_to=50000,
|
|
76
77
|
transmissions=[CarTransmission.MANUAL],
|
|
78
|
+
fuels=[CarFuel.DIESEL],
|
|
77
79
|
wheel_drive=[CarWheelDrive.RWD],
|
|
78
80
|
locations=[Location.STOCKHOLM],
|
|
79
81
|
horsepower_from=200,
|
|
@@ -136,5 +138,6 @@ asyncio.run(main())
|
|
|
136
138
|
## 📝 Notes
|
|
137
139
|
|
|
138
140
|
- REST API: https://blocket-api.se
|
|
141
|
+
- Webhooks: https://webhooks.blocket-api.se
|
|
139
142
|
- Source repo: https://github.com/dunderrrrrr/blocket_api
|
|
140
143
|
- PyPI: https://pypi.org/project/blocket-api/
|
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "blocket_api"
|
|
3
|
-
version = "0.5.
|
|
3
|
+
version = "0.5.4"
|
|
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"
|
|
7
7
|
requires-python = ">=3.10"
|
|
8
8
|
dependencies = [
|
|
9
9
|
"httpx>=0.28.1",
|
|
10
|
-
"beautifulsoup4>=4.
|
|
10
|
+
"beautifulsoup4>=4.15.0",
|
|
11
11
|
]
|
|
12
12
|
|
|
13
13
|
[project.optional-dependencies]
|
|
14
14
|
dev = [
|
|
15
|
-
"pre-commit>=4.
|
|
16
|
-
"pytest>=9.
|
|
17
|
-
"pytest-asyncio>=
|
|
18
|
-
"respx>=0.
|
|
19
|
-
"mypy>=
|
|
20
|
-
"ruff>=0.
|
|
15
|
+
"pre-commit>=4.6.2",
|
|
16
|
+
"pytest>=9.1.1",
|
|
17
|
+
"pytest-asyncio>=1.4.0",
|
|
18
|
+
"respx>=0.23.1",
|
|
19
|
+
"mypy>=2.3.1",
|
|
20
|
+
"ruff>=0.16.6",
|
|
21
21
|
"flask>=3.1.3",
|
|
22
22
|
"htpy>=26.5.1",
|
|
23
|
-
"gunicorn>=26.
|
|
23
|
+
"gunicorn>=26.2.0",
|
|
24
24
|
]
|
|
25
25
|
|
|
26
26
|
|
|
@@ -29,3 +29,6 @@ testpaths = [
|
|
|
29
29
|
"tests/*",
|
|
30
30
|
]
|
|
31
31
|
asyncio_mode = "auto"
|
|
32
|
+
|
|
33
|
+
[tool.ruff.lint]
|
|
34
|
+
ignore = ["B006", "RUF012", "SIM102", "PYI034"]
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|