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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file marktplaats-0.4.0.tar.gz.
File metadata
- Download URL: marktplaats-0.4.0.tar.gz
- Upload date:
- Size: 47.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.8.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2d64807692f5ab3f3d3c939c2d5d86365eb394fc0bb8d73a224a98d7bc56f698
|
|
| MD5 |
b0fe9c130fccc9c2b1b8bdca97247266
|
|
| BLAKE2b-256 |
2775919083daacf2c4b1230211cc7df3c643a6d8a02ddb1fa57a387a84e191e5
|
File details
Details for the file marktplaats-0.4.0-py3-none-any.whl.
File metadata
- Download URL: marktplaats-0.4.0-py3-none-any.whl
- Upload date:
- Size: 49.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.8.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
430f7ca6d4bb117a644c061ce5c7a29a5709a66a2b4ce455b013be9c11d391c9
|
|
| MD5 |
6dbfe3230445460fc547d63605b3ca8f
|
|
| BLAKE2b-256 |
9539e27077b88f04e0e075c356a196ee40d56dc4c2ff3f6f3220fab1fcc8e356
|