Skip to main content

BlocketAPI

PyPI version License Python PyPI - Downloads

BlocketAPI allows users to search blocket.se for ads.

Blocket is one of Sweden's largest online marketplaces. It was founded in 1996 and allows users to buy and sell a wide range of items, including cars, real estate, jobs, services, and second-hand goods. The platform is known for its extensive reach and user-friendly interface, making it a popular choice for Swedes looking to purchase or sell items quickly and efficiently.

🧑‍💻️ Install

Install BlocketAPI via PyPI...

pip install blocket-api # using pip
uv add blocket-api # using uv

📜 Docs

The full documentation can be found at blocket-api.se.

💁‍♀️ Usage

from blocket_api import (
    BlocketAPI,
    Category,
    CarColor,
    CarFuel,
    CarModel,
    CarSortOrder,
    CarTransmission,
    CarWheelDrive,
    Location,
)

api = BlocketAPI()

# search all of blocket
api.search(
    "Tamagotchi",
    sort_order=SortOrder.PRICE_ASC,
    locations=[Location.STOCKHOLM, Location.UPPSALA],
    category=Category.FRITID_HOBBY_OCH_UNDERHALLNING,
)

# search for cars
api.search_car(
    "Audi", # query is optional
    sort_order=CarSortOrder.MILEAGE_ASC,
    models=[CarModel.AUDI],
    colors=[CarColor.GULD],
    price_from=10000,
    price_to=50000,
    transmissions=[CarTransmission.MANUAL],
    fuels=[CarFuel.DIESEL],
    wheel_drive=[CarWheelDrive.RWD],
    locations=[Location.STOCKHOLM],
    horsepower_from=200,
    horsepower_to=300,
    org_id=1337, # dealer or store id
)

# search for boats
from blocket_api import BoatType

api.search_boat(
    "Mercury", # query is optional
    types=[BoatType.DAYCRUISER],
    locations=[Location.STOCKHOLM],
    length_from=10,
    length_to=15,    
    price_from=20000,
    price_to=90000,
    org_id=1337, # dealer or store id
)

# search for motorcycles
from blocket_api import McType, McModel

api.search_mc(
    "TC 150", # query is optional
    types=[McType.SPORT],
    locations=[Location.STOCKHOLM],
    models=[McModel.DUCATI],
    price_from=20000,
    price_to=90000,
    engine_volume_from=100,
    engine_volume_to=200,
    org_id=1337, # dealer or store id
)


# get ad details
from blocket_api import CarAd, RecommerceAd, BoatAd, McAd

api.get_ad(RecommerceAd(12345678))
api.get_ad(CarAd(12345678))
api.get_ad(BoatAd(12345678))
api.get_ad(McAd(12345678))

Async support

import asyncio
from blocket_api import AsyncBlocketAPI

async def main():
    async with AsyncBlocketAPI() as api:
        results = await api.search("iPhone 15")

asyncio.run(main())

📝 Notes

Metadata

Release files for blocket-api 0.5.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for blocket-api 0.5.4
File Size Uploaded Provenance Actions
blocket_api-0.5.4.tar.gz 13.5 kB Without provenance Details for blocket_api-0.5.4.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for blocket-api 0.5.4
File Interpreter ABI Platform Actions
blocket_api-0.5.4-py3-none-any.whl Python 3 none any Details for blocket_api-0.5.4-py3-none-any.whl

Total release size: 27.5 kB

Release files / blocket_api-0.5.4.tar.gz

Download URL blocket_api-0.5.4.tar.gz
Size 13.5 kB
Tags Source
SHA-256 checksum
How to use checksums
8be8750d97c6d4aed210d38deef7f11daaf9ba581c16a2ade4dce24713236d46
BLAKE2b-256 checksum
How to use checksums
1d296d1366ccda0fefa0e1b1cb8cfca58d6a49295784647fbfae006317c9e4d5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.15

Release files / blocket_api-0.5.4-py3-none-any.whl

Download URL blocket_api-0.5.4-py3-none-any.whl
Size 14.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b2b8b6d5275304fb03d49b173d46d3c4000a4624423b09a798f83e4442315835
BLAKE2b-256 checksum
How to use checksums
e7ed8e02499834175e373cc8db8274c48784000ffc9d5fe40f8991de628d1db4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.15

Security for blocket-api 0.5.4

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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

Release history Release notifications | RSS feed

This release

0.5.4 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page