mirror of
https://github.com/etienne-hd/lbc.git
synced 2026-04-27 09:15:43 +02:00
Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
76dda0cb76 | ||
|
|
2888942ecc | ||
|
|
fb31b43fd6 | ||
|
|
887ad99959 | ||
|
|
f5b08f0890 |
@@ -1,3 +1,11 @@
|
||||
## 1.0.6
|
||||
### Fixed
|
||||
* "Unknown location type" error when searching with a URL containing a zipcode.
|
||||
|
||||
## 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).
|
||||
|
||||
@@ -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} | "
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[project]
|
||||
name = "lbc"
|
||||
version = "1.0.4"
|
||||
version = "1.0.6"
|
||||
description = "Unofficial client for Leboncoin API"
|
||||
readme = "README.md"
|
||||
license = {text = "MIT"}
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@ def build_search_payload_with_url(
|
||||
location_parts = location.split("__") # City ['Paris', '48.86023250788424_2.339006433295173_9256'], Department ['d_69'], Region ['r_18'] or Place ['p_give a star if you like it!', '0.1234567891234_-0.1234567891234567_5000_5500']
|
||||
|
||||
prefix_parts = location_parts[0].split("_")
|
||||
if len(prefix_parts) == 2: # Department ['d', '1'], Region ['r', '1'], or Place ['p', 'give a star if you like it!']
|
||||
if len(prefix_parts[0]) == 1: # Department ['d', '1'], Region ['r', '1'], or Place ['p', 'give a star if you like it!']
|
||||
location_id = prefix_parts[1] # Department '1', Region '1' or Place 'give a star if you like it!'
|
||||
match prefix_parts[0]:
|
||||
case "d": # Department
|
||||
@@ -90,7 +90,7 @@ def build_search_payload_with_url(
|
||||
payload["filters"]["location"]["locations"].append(
|
||||
{
|
||||
"locationType": "city",
|
||||
"city": location_parts[0],
|
||||
#"city": location_parts[0],
|
||||
"area": build_area(area_values)
|
||||
}
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user