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,
    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],
    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

Download files

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

Source Distribution

blocket_api-0.5.2.tar.gz (13.3 kB view details)

Uploaded Source

Built Distribution

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

blocket_api-0.5.2-py3-none-any.whl (13.9 kB view details)

Uploaded Python 3

File details

Details for the file blocket_api-0.5.2.tar.gz.

File metadata

  • Download URL: blocket_api-0.5.2.tar.gz
  • Upload date:
  • Size: 13.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for blocket_api-0.5.2.tar.gz
Algorithm Hash digest
SHA256 76bfbca9f5bcff53a8e215e5dfff1b105c70c75cf1d64e26a35be132b6e5c66c
MD5 2547e245a7ea37ba7b7720549027997c
BLAKE2b-256 9d894830edc48f1d9fd2ad6810e21fcd0a1f3fe0c0de0e9718a58ba0c8d1c47d

See more details on using hashes here.

File details

Details for the file blocket_api-0.5.2-py3-none-any.whl.

File metadata

  • Download URL: blocket_api-0.5.2-py3-none-any.whl
  • Upload date:
  • Size: 13.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for blocket_api-0.5.2-py3-none-any.whl
Algorithm Hash digest
SHA256 881c2822ede7b700c2746660b6c61f4d8e06b21abdb240e1761e928163868ae1
MD5 b0d38986be8da09d84d3eba814b1e21e
BLAKE2b-256 c575017f3a15d19fdc6f54f7334a65ebe718b918c47ddda0d45dd557258885ba

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.5.2 This release

2 files

0.5.1

2 files

0.5.0

2 files

0.4.33

2 files

0.4.32

2 files

0.4.3

2 files

0.4.2

2 files

0.4.1

2 files

0.4.0

2 files

0.3.94

2 files

0.3.93

2 files

0.3.92

2 files

0.3.91

2 files

0.3.9

2 files

0.3.7

2 files

0.3.6

2 files

0.3.5

2 files

0.3.4

2 files

0.3.3

2 files

0.3.1

2 files

0.3.0

2 files

0.2.9

2 files

0.2.8

2 files

0.2.7

2 files

0.2.6

2 files

0.2.5

2 files

0.2.1

2 files

0.2.0

2 files

0.1.6

2 files

0.1.5

2 files

0.1.4

2 files

0.1.3

2 files

0.1.2

2 files

0.1.1

2 files

Supported by

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