blocket-api 0.3.94__tar.gz → 0.4.1__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.3.94
3
+ Version: 0.4.1
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
@@ -15,9 +15,8 @@ Requires-Dist: pydantic>=2.11.7
15
15
  Requires-Dist: mkdocs>=1.6.1
16
16
  Requires-Dist: mkdocs-material>=9.6.21
17
17
  Requires-Dist: mkdocs-swagger-ui-tag>=0.7.2
18
- Requires-Dist: websockets>=15.0.1
19
18
  Requires-Dist: beautifulsoup4>=4.14.2
20
- Requires-Dist: ruff>=0.14.7
19
+ Requires-Dist: ruff>=0.14.10
21
20
  Dynamic: license-file
22
21
 
23
22
  <p align="center">
@@ -75,6 +74,7 @@ api.search_car(
75
74
  price_to=50000,
76
75
  transmissions=[CarTransmission.MANUAL],
77
76
  locations=[Location.STOCKHOLM],
77
+ org_id=1337, # dealer or store id
78
78
  )
79
79
 
80
80
  # search for boats
@@ -88,6 +88,7 @@ api.search_boat(
88
88
  length_to=15,
89
89
  price_from=20000,
90
90
  price_to=90000,
91
+ org_id=1337, # dealer or store id
91
92
  )
92
93
 
93
94
  # search for motorcycles
@@ -102,6 +103,7 @@ api.search_mc(
102
103
  price_to=90000,
103
104
  engine_volume_from=100,
104
105
  engine_volume_to=200,
106
+ org_id=1337, # dealer or store id
105
107
  )
106
108
 
107
109
 
@@ -53,6 +53,7 @@ api.search_car(
53
53
  price_to=50000,
54
54
  transmissions=[CarTransmission.MANUAL],
55
55
  locations=[Location.STOCKHOLM],
56
+ org_id=1337, # dealer or store id
56
57
  )
57
58
 
58
59
  # search for boats
@@ -66,6 +67,7 @@ api.search_boat(
66
67
  length_to=15,
67
68
  price_from=20000,
68
69
  price_to=90000,
70
+ org_id=1337, # dealer or store id
69
71
  )
70
72
 
71
73
  # search for motorcycles
@@ -80,6 +82,7 @@ api.search_mc(
80
82
  price_to=90000,
81
83
  engine_volume_from=100,
82
84
  engine_volume_to=200,
85
+ org_id=1337, # dealer or store id
83
86
  )
84
87
 
85
88
 
@@ -17,7 +17,7 @@ class RecommerceAd:
17
17
  def url(self) -> str:
18
18
  return f"{SITE_URL}/recommerce/forsale/item/{self.id}"
19
19
 
20
- def parse(self, response: Response) -> Any:
20
+ def parse(self, response: Response) -> dict[str, Any]:
21
21
  soup = BeautifulSoup(response.content, "html.parser")
22
22
  json_script_tag = soup.select_one(
23
23
  'script:-soup-contains("window.__staticRouterHydrationData")'
@@ -41,7 +41,7 @@ class MobilityAd:
41
41
  def url(self) -> str:
42
42
  return f"{SITE_URL}/mobility/item/{self.id}"
43
43
 
44
- def parse(self, response: Response) -> dict:
44
+ def parse(self, response: Response) -> dict[str, Any]:
45
45
  soup = BeautifulSoup(response.content, "html.parser")
46
46
  grid = soup.find("div", class_="grid grid-cols-1 md:grid-cols-3 md:gap-x-32")
47
47
 
@@ -52,11 +52,11 @@ class BlocketAPI:
52
52
  locations: list[Location] = [],
53
53
  category: Category | None = None,
54
54
  sub_category: SubCategory | None = None,
55
- ) -> Any:
55
+ ) -> dict[str, Any]:
56
56
  if category and sub_category:
57
57
  raise AssertionError("Cannot specify both category and sub_categories")
58
58
 
59
- url = f"{SITE_URL}/recommerce-search-page/api/search/SEARCH_ID_BAP_COMMON"
59
+ url = f"{SITE_URL}/recommerce/forsale/search/api/search/SEARCH_ID_BAP_COMMON"
60
60
 
61
61
  param_dict: dict[str, str | int | None] = {
62
62
  "q": query,
@@ -88,7 +88,8 @@ class BlocketAPI:
88
88
  milage_to: int | None = None,
89
89
  colors: list[CarColor] = [],
90
90
  transmissions: list[CarTransmission] = [],
91
- ) -> Any:
91
+ org_id: int | None = None,
92
+ ) -> dict[str, Any]:
92
93
  url = f"{SITE_URL}/mobility/search/api/search/SEARCH_ID_CAR_USED"
93
94
 
94
95
  param_dict: dict[str, str | int | None] = {
@@ -101,6 +102,7 @@ class BlocketAPI:
101
102
  "year_to": year_to,
102
103
  "milage_from": milage_from,
103
104
  "milage_to": milage_to,
105
+ "org_id": org_id,
104
106
  }
105
107
 
106
108
  params = [QueryParam(k, v) for k, v in param_dict.items() if v is not None]
@@ -125,6 +127,7 @@ class BlocketAPI:
125
127
  price_to: int | None = None,
126
128
  length_from: int | None = None,
127
129
  length_to: int | None = None,
130
+ org_id: int | None = None,
128
131
  ) -> Any:
129
132
  url = f"{SITE_URL}/mobility/search/api/search/SEARCH_ID_BOAT_USED"
130
133
 
@@ -136,6 +139,7 @@ class BlocketAPI:
136
139
  "price_to": price_to,
137
140
  "length_feet_from": length_from,
138
141
  "length_feet_to": length_to,
142
+ "org_id": org_id,
139
143
  }
140
144
 
141
145
  params = [QueryParam(k, v) for k, v in param_dict.items() if v is not None]
@@ -158,7 +162,8 @@ class BlocketAPI:
158
162
  price_to: int | None = None,
159
163
  engine_volume_from: int | None = None,
160
164
  engine_volume_to: int | None = None,
161
- ) -> Any:
165
+ org_id: int | None = None,
166
+ ) -> dict[str, Any]:
162
167
  url = f"{SITE_URL}/mobility/search/api/search/SEARCH_ID_MC_USED"
163
168
 
164
169
  param_dict: dict[str, str | int | None] = {
@@ -169,6 +174,7 @@ class BlocketAPI:
169
174
  "price_to": price_to,
170
175
  "engine_volume_from": engine_volume_from,
171
176
  "engine_volume_to": engine_volume_to,
177
+ "org_id": org_id,
172
178
  }
173
179
 
174
180
  params = [QueryParam(k, v) for k, v in param_dict.items() if v is not None]
@@ -179,6 +185,6 @@ class BlocketAPI:
179
185
 
180
186
  return _request(url=url, params=params).json()
181
187
 
182
- def get_ad(self, ad: RecommerceAd | CarAd | BoatAd | McAd) -> dict:
188
+ def get_ad(self, ad: RecommerceAd | CarAd | BoatAd | McAd) -> dict[str, Any]:
183
189
  response = _request(url=ad.url, params=[])
184
190
  return ad.parse(response)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: blocket_api
3
- Version: 0.3.94
3
+ Version: 0.4.1
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
@@ -15,9 +15,8 @@ Requires-Dist: pydantic>=2.11.7
15
15
  Requires-Dist: mkdocs>=1.6.1
16
16
  Requires-Dist: mkdocs-material>=9.6.21
17
17
  Requires-Dist: mkdocs-swagger-ui-tag>=0.7.2
18
- Requires-Dist: websockets>=15.0.1
19
18
  Requires-Dist: beautifulsoup4>=4.14.2
20
- Requires-Dist: ruff>=0.14.7
19
+ Requires-Dist: ruff>=0.14.10
21
20
  Dynamic: license-file
22
21
 
23
22
  <p align="center">
@@ -75,6 +74,7 @@ api.search_car(
75
74
  price_to=50000,
76
75
  transmissions=[CarTransmission.MANUAL],
77
76
  locations=[Location.STOCKHOLM],
77
+ org_id=1337, # dealer or store id
78
78
  )
79
79
 
80
80
  # search for boats
@@ -88,6 +88,7 @@ api.search_boat(
88
88
  length_to=15,
89
89
  price_from=20000,
90
90
  price_to=90000,
91
+ org_id=1337, # dealer or store id
91
92
  )
92
93
 
93
94
  # search for motorcycles
@@ -102,6 +103,7 @@ api.search_mc(
102
103
  price_to=90000,
103
104
  engine_volume_from=100,
104
105
  engine_volume_to=200,
106
+ org_id=1337, # dealer or store id
105
107
  )
106
108
 
107
109
 
@@ -7,6 +7,5 @@ pydantic>=2.11.7
7
7
  mkdocs>=1.6.1
8
8
  mkdocs-material>=9.6.21
9
9
  mkdocs-swagger-ui-tag>=0.7.2
10
- websockets>=15.0.1
11
10
  beautifulsoup4>=4.14.2
12
- ruff>=0.14.7
11
+ ruff>=0.14.10
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "blocket_api"
3
- version = "0.3.94"
3
+ version = "0.4.1"
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"
@@ -15,9 +15,8 @@ dependencies = [
15
15
  "mkdocs>=1.6.1",
16
16
  "mkdocs-material>=9.6.21",
17
17
  "mkdocs-swagger-ui-tag>=0.7.2",
18
- "websockets>=15.0.1",
19
18
  "beautifulsoup4>=4.14.2",
20
- "ruff>=0.14.7",
19
+ "ruff>=0.14.10",
21
20
  ]
22
21
 
23
22
 
File without changes
File without changes