Name | lbc JSON |
Version |
1.0.9
JSON |
| download |
home_page | None |
Summary | Unofficial client for Leboncoin API |
upload_time | 2025-08-20 17:47:19 |
maintainer | None |
docs_url | None |
author | None |
requires_python | >=3.9 |
license | MIT |
keywords |
api
lbc
leboncoin
wrapper
|
VCS |
 |
bugtrack_url |
|
requirements |
curl_cffi
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# lbc
[](https://pypi.org/project/lbc)

[](https://github.com/etienne-hd/lbc/blob/master/LICENSE)
**Unofficial client for Leboncoin API**
```python
import lbc
client = lbc.Client()
location = lbc.City(
lat=48.85994982004764,
lng=2.33801967847424,
radius=10_000, # 10 km
city="Paris"
)
result = client.search(
text="maison",
locations=[location],
page=1,
limit=35,
sort=lbc.Sort.NEWEST,
ad_type=lbc.AdType.OFFER,
category=lbc.Category.IMMOBILIER,
square=[200, 400],
price=[300_000, 700_000]
)
for ad in result.ads:
print(ad.url, ad.subject, ad.price)
```
*lbc is not affiliated with, endorsed by, or in any way associated with Leboncoin or its services. Use at your own risk.*
## Installation
Required **Python 3.9+**
```bash
pip install lbc
```
## Usage
**Full documentation will be available soon.**
Start with the [examples](examples/) to quickly understand how to use the library in real-world scenarios.
### Client
To create client you need to use `lbc.Client` class
```python
import lbc
client = lbc.Client()
```
#### Proxy
You can also configure the client to use a proxy by providing a `Proxy` object:
```python
proxy = lbc.Proxy(
host=...,
port=...,
username=...,
password=...
)
client = lbc.Client(proxy=proxy)
```
### Search
To perform a search, use the `client.search` method.
This function accepts keyword arguments (`**kwargs`) to customize your query.
For example, if you're looking for houses that include both land and parking, you can specify:
```python
real_estate_type=["3", "4"]
```
These values correspond to what you’d find in a typical Leboncoin URL, like:
```
https://www.leboncoin.fr/recherche?category=9&text=maison&...&real_estate_type=3,4
```
Here's a complete example of a search query:
```python
client.search(
text="maison",
locations=[location],
page=1,
limit=35,
limit_alu=0,
sort=lbc.Sort.NEWEST,
ad_type=lbc.AdType.OFFER,
category=lbc.Category.IMMOBILIER,
owner_type=lbc.OwnerType.ALL,
search_in_title_only=True,
square=[200, 400],
price=[300_000, 700_000],
)
```
#### Alternatively
You can also perform search using a full Leboncoin URL:
```python
client.search(
url="https://www.leboncoin.fr/recherche?category=9&text=maison&locations=Paris__48.86023250788424_2.339006433295173_9256&square=100-200price=500000-1000000&rooms=1-6&bedrooms=3-6&outside_access=garden,terrace&orientation=south_west&owner_type=private",
page=1,
limit=35
)
```
If `url` is provided, it overrides other keyword parameters such as `text`, `category`, `locations`, etc. However, pagination parameters like `page`, `limit`, and `limit_alu` are still applied.
### Location
The `locations` parameter accepts a list of one or more location objects. You can use one of the following:
* `lbc.Region(...)`
* `lbc.Department(...)`
* `lbc.City(...)`
Each one corresponds to a different level of geographic granularity.
#### City example
```python
location = lbc.City(
lat=48.85994982004764,
lng=2.33801967847424,
radius=10_000, # in meters
city="Paris"
)
```
#### Region / Department example
```python
from lbc import Region, Department
region = Region.ILE_DE_FRANCE
department = Department.PARIS
```
### 403 Error
If you encounter a **403 Forbidden** error, it usually means your requests are being blocked by [Datadome](https://datadome.co).
To resolve this:
* Try reducing the request frequency (add delays between requests).
* If you're using a proxy, make sure it is **clean** and preferably located in **France**.
Using residential or mobile proxies can also help avoid detection.
## License
This project is licensed under the MIT License.
## Support
<a href="https://www.buymeacoffee.com/etienneh" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png" alt="Buy Me A Coffee" style="height: 60px !important;width: 217px !important;" ></a>
You can contact me via [Telegram](https://t.me/etienne_hd) or [Discord](https://discord.com/users/1153975318990827552) if you need help with scraping services or want to write a library.
Raw data
{
"_id": null,
"home_page": null,
"name": "lbc",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.9",
"maintainer_email": "Etienne HODE <hode.etienne@gmail.com>",
"keywords": "api, lbc, leboncoin, wrapper",
"author": null,
"author_email": "Etienne HODE <hode.etienne@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/89/7b/7526cb777f6ede32028fbabc47da4a3d83974b5bc710ff4cfe581e81d59b/lbc-1.0.9.tar.gz",
"platform": null,
"description": "# lbc\n[](https://pypi.org/project/lbc)\n\n[](https://github.com/etienne-hd/lbc/blob/master/LICENSE)\n\n**Unofficial client for Leboncoin API**\n\n```python\nimport lbc\n\nclient = lbc.Client()\n\nlocation = lbc.City( \n lat=48.85994982004764,\n lng=2.33801967847424,\n radius=10_000, # 10 km\n city=\"Paris\"\n)\n\nresult = client.search(\n text=\"maison\",\n locations=[location],\n page=1,\n limit=35,\n sort=lbc.Sort.NEWEST,\n ad_type=lbc.AdType.OFFER,\n category=lbc.Category.IMMOBILIER,\n square=[200, 400],\n price=[300_000, 700_000]\n)\n\nfor ad in result.ads:\n print(ad.url, ad.subject, ad.price)\n```\n*lbc is not affiliated with, endorsed by, or in any way associated with Leboncoin or its services. Use at your own risk.*\n\n## Installation\nRequired **Python 3.9+**\n```bash\npip install lbc\n```\n\n## Usage\n**Full documentation will be available soon.**\n\nStart with the [examples](examples/) to quickly understand how to use the library in real-world scenarios.\n\n### Client\nTo create client you need to use `lbc.Client` class\n```python\nimport lbc\n\nclient = lbc.Client()\n```\n\n#### Proxy\nYou can also configure the client to use a proxy by providing a `Proxy` object:\n```python\nproxy = lbc.Proxy(\n host=...,\n port=...,\n username=...,\n password=...\n)\nclient = lbc.Client(proxy=proxy)\n```\n\n\n### Search\n\nTo perform a search, use the `client.search` method.\n\nThis function accepts keyword arguments (`**kwargs`) to customize your query.\nFor example, if you're looking for houses that include both land and parking, you can specify:\n\n```python\nreal_estate_type=[\"3\", \"4\"]\n```\n\nThese values correspond to what you\u2019d find in a typical Leboncoin URL, like:\n\n```\nhttps://www.leboncoin.fr/recherche?category=9&text=maison&...&real_estate_type=3,4\n```\n\nHere's a complete example of a search query:\n\n```python\nclient.search(\n text=\"maison\",\n locations=[location],\n page=1,\n limit=35,\n limit_alu=0,\n sort=lbc.Sort.NEWEST,\n ad_type=lbc.AdType.OFFER,\n category=lbc.Category.IMMOBILIER,\n owner_type=lbc.OwnerType.ALL,\n search_in_title_only=True,\n square=[200, 400],\n price=[300_000, 700_000],\n)\n```\n\n#### Alternatively\n\nYou can also perform search using a full Leboncoin URL:\n\n```python\nclient.search(\n url=\"https://www.leboncoin.fr/recherche?category=9&text=maison&locations=Paris__48.86023250788424_2.339006433295173_9256&square=100-200price=500000-1000000&rooms=1-6&bedrooms=3-6&outside_access=garden,terrace&orientation=south_west&owner_type=private\",\n page=1,\n limit=35\n)\n```\n\nIf `url` is provided, it overrides other keyword parameters such as `text`, `category`, `locations`, etc. However, pagination parameters like `page`, `limit`, and `limit_alu` are still applied.\n\n### Location\n\nThe `locations` parameter accepts a list of one or more location objects. You can use one of the following:\n\n* `lbc.Region(...)`\n* `lbc.Department(...)`\n* `lbc.City(...)`\n\nEach one corresponds to a different level of geographic granularity.\n\n#### City example\n\n```python\nlocation = lbc.City(\n lat=48.85994982004764,\n lng=2.33801967847424,\n radius=10_000, # in meters\n city=\"Paris\"\n)\n```\n\n#### Region / Department example\n\n```python\nfrom lbc import Region, Department\n\nregion = Region.ILE_DE_FRANCE\ndepartment = Department.PARIS\n```\n\n### 403 Error\n\nIf you encounter a **403 Forbidden** error, it usually means your requests are being blocked by [Datadome](https://datadome.co).\nTo resolve this:\n\n* Try reducing the request frequency (add delays between requests).\n* If you're using a proxy, make sure it is **clean** and preferably located in **France**.\n\nUsing residential or mobile proxies can also help avoid detection.\n\n## License\n\nThis project is licensed under the MIT License.\n\n## Support\n\n<a href=\"https://www.buymeacoffee.com/etienneh\" target=\"_blank\"><img src=\"https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png\" alt=\"Buy Me A Coffee\" style=\"height: 60px !important;width: 217px !important;\" ></a>\n\nYou can contact me via [Telegram](https://t.me/etienne_hd) or [Discord](https://discord.com/users/1153975318990827552) if you need help with scraping services or want to write a library.",
"bugtrack_url": null,
"license": "MIT",
"summary": "Unofficial client for Leboncoin API",
"version": "1.0.9",
"project_urls": {
"Changelog": "https://github.com/etienne-hd/lbc/blob/main/CHANGELOG.md",
"Homepage": "https://github.com/etienne-hd/lbc",
"Repository": "https://github.com/etienne-hd/lbc"
},
"split_keywords": [
"api",
" lbc",
" leboncoin",
" wrapper"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "8a109a8b2fa6cbf15f576c760ae5d68c04c1c626c1516cf0f2b25081598d8482",
"md5": "d43cecd46e497958ba71a837261509ae",
"sha256": "be837b54bef22a42c7f23f04ddaa247295f3f0b259001071569a09ca33ff4251"
},
"downloads": -1,
"filename": "lbc-1.0.9-py3-none-any.whl",
"has_sig": false,
"md5_digest": "d43cecd46e497958ba71a837261509ae",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9",
"size": 18690,
"upload_time": "2025-08-20T17:47:18",
"upload_time_iso_8601": "2025-08-20T17:47:18.418653Z",
"url": "https://files.pythonhosted.org/packages/8a/10/9a8b2fa6cbf15f576c760ae5d68c04c1c626c1516cf0f2b25081598d8482/lbc-1.0.9-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "897b7526cb777f6ede32028fbabc47da4a3d83974b5bc710ff4cfe581e81d59b",
"md5": "2177baa007b939879948095fa13f237c",
"sha256": "591d391f4d9789bfa2acb7c61418202e8509f44a74b7dae20115cdf9411066c7"
},
"downloads": -1,
"filename": "lbc-1.0.9.tar.gz",
"has_sig": false,
"md5_digest": "2177baa007b939879948095fa13f237c",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 19745,
"upload_time": "2025-08-20T17:47:19",
"upload_time_iso_8601": "2025-08-20T17:47:19.476026Z",
"url": "https://files.pythonhosted.org/packages/89/7b/7526cb777f6ede32028fbabc47da4a3d83974b5bc710ff4cfe581e81d59b/lbc-1.0.9.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-08-20 17:47:19",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "etienne-hd",
"github_project": "lbc",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"requirements": [
{
"name": "curl_cffi",
"specs": [
[
"==",
"0.11.3"
]
]
}
],
"lcname": "lbc"
}