Skip to main content

A small Python package to request listings from marktplaats.nl

Project description

marktplaats-py

A small Python package to request listings from marktplaats.nl. It supports python 3.9+.

Installing

pip install marktplaats

Example

This is an example on how to use the library:

from datetime import datetime, timedelta

from marktplaats import Condition, SearchQuery, SortBy, SortOrder, category_from_name

search = SearchQuery(
    query="gazelle",  # Search query. Can be left out, but then category must be specified.
    zip_code="1016LV",  # Zip code to base distance from
    distance=100000,  # Max distance from the zip code for listings
    price_from=0,  # Lowest price to search for
    price_to=100,  # Highest price to search for
    limit=5,  # Max listings (page size, max 100)
    offset=0,  # Offset for listings (page * limit)
    sort_by=SortBy.OPTIMIZED,  # DATE, PRICE, LOCATION, OPTIMIZED
    sort_order=SortOrder.ASC,  # ASCending or DESCending
    condition=Condition.NEW,  # NEW, AS_GOOD_AS_NEW, USED or category-specific
    offered_since=datetime.now() - timedelta(days=7),  # Filter listings since a point in time
    category=category_from_name("Fietsen en Brommers"),  # Filter in specific category (L1) or subcategory (L2)
)

listings = search.get_listings()

for listing in listings:
    print(listing.title)
    print(listing.description)
    print(listing.price)
    print(listing.price_as_string(lang="nl"))
    print(listing.price_type)
    print(listing.link)

    # the location object
    print(listing.location)

    # the seller object
    print(listing.seller)

    # the date object
    print(listing.date)

    # the full seller object (another request)
    print(listing.seller.get_seller())

    # medium-sized cover image
    print(listing.first_image.medium)

    # image urls for all the listing's image
    # (this sends another HTTP request)
    for image in listing.get_images():
        print(image)

    print("-----------------------------")

Categories

Filtering by Marktplaats category is possible. Please refer to the categories index at CATEGORIES.md

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

marktplaats-0.5.0.tar.gz (47.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

marktplaats-0.5.0-py3-none-any.whl (50.1 kB view details)

Uploaded Python 3

File details

Details for the file marktplaats-0.5.0.tar.gz.

File metadata

  • Download URL: marktplaats-0.5.0.tar.gz
  • Upload date:
  • Size: 47.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.14 {"installer":{"name":"uv","version":"0.11.14","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for marktplaats-0.5.0.tar.gz
Algorithm Hash digest
SHA256 a598d1449ef27f96a0850742dc5716a4ca20dc24eaeec1d57266a1885fd69821
MD5 c0b5e4b4f0f7456c4f62e05613f2f128
BLAKE2b-256 594e4497ba1efe7c63a4b4ce67fc3328877b39f7c39eb3da3ba1f1e2cae7e47f

See more details on using hashes here.

File details

Details for the file marktplaats-0.5.0-py3-none-any.whl.

File metadata

  • Download URL: marktplaats-0.5.0-py3-none-any.whl
  • Upload date:
  • Size: 50.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.14 {"installer":{"name":"uv","version":"0.11.14","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for marktplaats-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f072dcb3a3b7a9566b1a2b77a1cf3fca95ea71aafc911a7c830f818b5d477929
MD5 2c7c83d82935fb10366694859448a962
BLAKE2b-256 68b63c788d784a990b832b6a272027e117b7342c34fe0af9c414cf6b503162a3

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page