get_ad & get_user functions, extended user info (badges, feedback, pro), and new usage examples

This commit is contained in:
etienne-hd
2025-06-26 23:36:54 +02:00
parent 241645baae
commit 5841f55b20
20 changed files with 584 additions and 180 deletions

22
examples/get_ad.py Normal file
View File

@@ -0,0 +1,22 @@
"""Get detailed information about an ad on Leboncoin using its ID."""
import lbc
def main() -> None:
# Initialize the Leboncoin API client
client = lbc.Client()
# Fetch an ad by its Leboncoin ID (replace with a real one for testing)
ad = client.get_ad("0123456789")
# Print basic information about the ad
print("Title:", ad.subject)
print("Price:", ad.price)
print("Favorites:", ad.favorites)
print("First published on:", ad.first_publication_date)
# Print information about the user who posted the ad
print("User info:", ad.user)
if __name__ == "__main__":
main()