BlocketAPI
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
- REST API: https://blocket-api.se
- Source repo: https://github.com/dunderrrrrr/blocket_api
- PyPI: https://pypi.org/project/blocket-api/
Metadata
Release files for blocket-api 0.5.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| blocket_api-0.5.3.tar.gz | 13.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| blocket_api-0.5.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 27.2 kB
Release files / blocket_api-0.5.3.tar.gz
| Download URL | blocket_api-0.5.3.tar.gz |
|---|---|
| Size | 13.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3e8942564464f009ec2956c9e811a41182c9f450ce7bfe633d585edce28eac1b
|
|
BLAKE2b-256 checksum How to use checksums |
6e795a9e275fa23caae489b8708bd07938866d37a13048458813d16066ca80de
|
| 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.3-py3-none-any.whl
| Download URL | blocket_api-0.5.3-py3-none-any.whl |
|---|---|
| Size | 13.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a2b02b430cc797d59b629cc140186c55bef277790a65c15066d69fd737aa3f3d
|
|
BLAKE2b-256 checksum How to use checksums |
9348017c7dfc4bd90619ab5cdef5b9b26292e741ce1d5ae8161a45c6cd6b712e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.15
|