kleinanzeigen
Async Python client for kleinanzeigen.de, using plain HTTP with curl_cffi and BeautifulSoup. No browser required.
Search listings and fetch ad details through an async library, a CLI, or an MCP server.
Requests are made sequentially with delays between pages. Check kleinanzeigen.de's terms of service before use.
Requirements
- Python 3.14 or later.
Installation
Add the package to your Python project:
uv add kleinanzeigen
Or install it with pip:
pip install kleinanzeigen
For standalone CLI and MCP commands, install with pipx:
pipx install kleinanzeigen
Library
Use Kleinanzeigen as an async context manager to manage the HTTP session.
Searches return a SearchResult with listings and pagination totals;
single-ad lookups return a ListingDetail or None if the ad is gone.
Search and fetch listings
import asyncio
from kleinanzeigen import Kleinanzeigen, SearchParams
async def main():
async with Kleinanzeigen() as ka:
result = await ka.search(
SearchParams(query="fahrrad", location="Berlin", radius=25, pages=2)
)
for listing in result.listings:
print(listing.title, listing.price, listing.url)
detail = await ka.get_listing("123456789")
if detail is not None:
print(detail.title, detail.price.amount, detail.seller.name)
asyncio.run(main())
Saved searches and date cutoffs
Within the same async context, reuse a filtered search URL or restrict results by publish date. Naive datetimes are interpreted as Europe/Berlin local time.
from datetime import datetime
result = await ka.search_url("https://www.kleinanzeigen.de/s-fahrrad/k0", pages=3)
result = await ka.search(
SearchParams(query="fahrrad", published_after=datetime(2026, 1, 1), pages=2)
)
Page-by-page results
Use iter_search() or iter_search_url() to process each page as it arrives,
within the same async context:
async for progress, listings in ka.iter_search(SearchParams(query="fahrrad", pages=2)):
print(progress.page, progress.total_pages)
for listing in listings:
print(listing.title, listing.url)
Set pages=0 to fetch all available pages. Keyword searches default to all
pages; URL searches default to one.
CLI
Search from the terminal with progress updates and a results table. Use
--json on search commands for machine-readable output; get displays
formatted ad details and exits with status 1 if the ad is gone.
# Search by keyword and location
kleinanzeigen search -q 'fahrrad' -l 'Berlin' --radius 5 --pages 3
# Filter by price and return JSON
kleinanzeigen search -q 'iphone' --min-price 100 --max-price 500 --pages 1 --json
# Use a saved or filtered search URL
kleinanzeigen search-url 'https://www.kleinanzeigen.de/s-fahrrad/k0' --pages 3
# Fetch a single ad by URL or numeric ID
kleinanzeigen get 123456789
MCP server
Connect an MCP-compatible client to the kleinanzeigen-mcp server to search
listings and retrieve ad details. The server uses the stdio transport.
| Tool | Description |
|---|---|
search |
Search listings by keyword, location, and price. |
search_url |
Search using a saved or filtered Kleinanzeigen URL. |
get_listing |
Fetch full ad details by URL or numeric ID. |
Add the server to your MCP client config:
{
"mcpServers": {
"kleinanzeigen": {
"command": "kleinanzeigen-mcp"
}
}
}
Both search tools support publish-date filtering and a limit on returned
listings. Results include listings, pagination totals, and a returned count.
Missing ads return {"error": "listing not found or removed"}.
Development
Set up the environment and run the offline tests and lint checks:
uv sync
uv run pytest
pre-commit run -a
Run the CLI directly from the checkout:
uv run kleinanzeigen search -q 'fahrrad' --pages 1
The included .mcp.json registers kleinanzeigen-dev using
uv run kleinanzeigen-mcp. MCP clients that support project-level
configuration can load it from this checkout.
Acknowledgements
Based on ebay-kleinanzeigen-api, adapted to work without a browser.
Metadata
Release files for kleinanzeigen 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| kleinanzeigen-0.1.1.tar.gz | 91.9 kB | With provenance | Details for kleinanzeigen-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| kleinanzeigen-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for kleinanzeigen-0.1.1-py3-none-any.whl |
Total release size: 114.3 kB
Release files / kleinanzeigen-0.1.1.tar.gz
| Download URL | kleinanzeigen-0.1.1.tar.gz |
|---|---|
| Size | 91.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
81a1f2a143a75c58468f27e5fe19fc156b9516c41d7b68974beced41b6b1f5ec
|
|
BLAKE2b-256 checksum How to use checksums |
c45eb60c0899219a76583704b7e1c1e1b2908eeac9161cc3392cc33721efa394
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 9, 2026.
Transparency logRelease files / kleinanzeigen-0.1.1-py3-none-any.whl
| Download URL | kleinanzeigen-0.1.1-py3-none-any.whl |
|---|---|
| Size | 22.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c0693ed94d40006e068345cabffc41f2261b2b79bc5fca0e4223a306f6e99825
|
|
BLAKE2b-256 checksum How to use checksums |
a2e66795c813d5db8931aa44bc582f5baca41df6afbd4a7334afc958aec0a344
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 9, 2026.
Transparency logSecurity for kleinanzeigen 0.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for kleinanzeigen-0.1.1.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 9, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.