https://github.com/dunderrrrrr/blocket_api
A python API wrapper for blocket.se 🏷
https://github.com/dunderrrrrr/blocket_api
api blocket blocket-api blocket-se-api blocketse python wrapper
Last synced: 2 months ago
JSON representation
A python API wrapper for blocket.se 🏷
- Host: GitHub
- URL: https://github.com/dunderrrrrr/blocket_api
- Owner: dunderrrrrr
- License: wtfpl
- Created: 2024-07-16T13:10:53.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-07-18T11:46:33.000Z (over 1 year ago)
- Last Synced: 2024-11-14T05:42:12.712Z (over 1 year ago)
- Topics: api, blocket, blocket-api, blocket-se-api, blocketse, python, wrapper
- Language: Python
- Homepage: https://blocket.se
- Size: 30.3 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-sweden - Python
- awesome-swedish-opensource - BlocketAPI
README
# BlocketAPI
[](https://pypi.org/project/blocket_api/) [](https://github.com/dunderrrrrr/blocket_api/blob/main/LICENSE)  
BlocketAPI allows users to search [blocket.se](https://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...
```sh
pip install blocket-api
```
or use [blocket-api.se](https://blocket-api.se) without installing anything!
## 💁♀️ Usage
```py
from blocket_api import (
BlocketAPI,
Category,
CarColor,
CarModel,
CarSortOrder,
CarTransmission,
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],
locations=[Location.STOCKHOLM],
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))
```
## 📝 Notes
- REST API: https://blocket-api.se
- Source repo: https://github.com/dunderrrrrr/blocket_api
- PyPI: https://pypi.org/project/blocket-api/