3 Commits
1.0.4 ... 1.0.5

Author SHA1 Message Date
etienne-hd
fb31b43fd6 1.0.5 2025-06-27 19:45:30 +02:00
etienne-hd
887ad99959 1.0.5 2025-06-27 19:45:12 +02:00
etienne-hd
f5b08f0890 fix: handle exceptions when fetching pro user data to avoid crashes 2025-06-27 19:43:16 +02:00
4 changed files with 10 additions and 3 deletions

View File

@@ -1,3 +1,7 @@
## 1.0.5
### Fixed
* 404 error when fetching a pro user who doesn't have a public page
## 1.0.4
### Added
* A lot of new user information can be retrieved (feedback, badges & professional info).

View File

@@ -32,7 +32,7 @@ def main() -> None:
# Display only professional ads with their legal/professional data
for ad in result.ads:
if ad.user.is_pro and ad.user.pro:
if ad.user.pro:
print(
f"Store: {ad.user.pro.online_store_name} | "
f"SIRET: {ad.user.pro.siret} | "

View File

@@ -1,6 +1,6 @@
[project]
name = "lbc"
version = "1.0.4"
version = "1.0.5"
description = "Unofficial client for Leboncoin API"
readme = "README.md"
license = {text = "MIT"}

View File

@@ -117,7 +117,10 @@ class Client(Session):
pro_data = None
if user_data.get("account_type") == "pro":
pro_data = self._fetch(method="GET", url=f"https://api.leboncoin.fr/api/onlinestores/v2/users/{user_id}?fields=all")
try:
pro_data = self._fetch(method="GET", url=f"https://api.leboncoin.fr/api/onlinestores/v2/users/{user_id}?fields=all")
except Exception:
pass # Some professional users may not have a Leboncoin page.
return User._build(user_data=user_data, pro_data=pro_data)