mirror of
https://github.com/etienne-hd/lbc.git
synced 2026-04-10 01:25:35 +02:00
fix: handle exceptions when fetching pro user data to avoid crashes
This commit is contained in:
@@ -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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user