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.7+.

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.3.1.tar.gz (89.3 kB view details)

Uploaded Source

Built Distribution

marktplaats-0.3.1-py3-none-any.whl (48.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: marktplaats-0.3.1.tar.gz
  • Upload date:
  • Size: 89.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.7.8

File hashes

Hashes for marktplaats-0.3.1.tar.gz
Algorithm Hash digest
SHA256 486e65793e0238738becee3f5a5d6047dd56dc1d1b0149ce0471c85675201aca
MD5 a757969b87f92183f8c10d963c6afeb6
BLAKE2b-256 f8517f6567831e7714ee8c2d1aace8be8b5ce6a7732ccfb58e00039f8eea2bf2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for marktplaats-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c9b6ee7c8bf3de192f912f15c99da0d1bd8c597fdb5bc8bde6ef9df4e11aa97e
MD5 65aa8beafa496accc16ce4c177e0e002
BLAKE2b-256 50c2fe2e8c3ba274ac9894ebe53725343ab990e76482c85ded8ad1f2f7cad4c6

See more details on using hashes here.

Supported by

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