Python client for the BrickLink API
Project description
Bricklink API Python Wrapper
This Python library provides a clean wrapper for the Bricklink API, making it simple to integrate Bricklink's marketplace functionality into your Python projects. Access item searches, inventory management, order processing, and more through an intuitive interface that handles all the API complexities behind the scenes.
Key Features
- Item Search - Find Bricklink items using filters for keywords, categories, colors, and more
- Store Inventory - Access store inventories with current quantities and pricing
- Order Management - Handle order creation, updates, and tracking
- Catalog Information - Get detailed item data including categories and images
- Price Guide - Access current market pricing based on condition and quantity
- Authentication - Simplified token management for API access
Installation
Install pre-release version
pip install bricklink-py --pre
Quick Start
from bricklink_py import Bricklink
session = Bricklink('your_credentials')
Example Usage
from html import unescape
from bricklink_py import Bricklink
# Initialize API session
session = Bricklink(
consumer_key='your_consumer_key',
consumer_secret='your_consumer_secret',
token='your_token',
token_secret='your_token_secret'
)
# Check pricing for a specific set
set_no = '75281-1'
# Get basic set information
set_item = session.catalog_item.get_item('SET', set_no)
set_name = unescape(set_item['name'])
set_weight = set_item['weight']
year_released = set_item['year_released']
# Get pricing data
price_guide = session.catalog_item.get_price_guide('SET', set_no, guide_type='sold')
avg_price = float(price_guide['avg_price'])
currency = price_guide['currency_code']
print(f'The "{set_name}" set was released in {year_released}.')
print(f'It weighs {set_weight}g.')
print(f'Average sold price for last 6 months: {avg_price:.2f} {currency}')
Output:
The "Anakin's Jedi Interceptor" set was released in 2020.
It weighs 360.00g.
Average sold price for last 6 months: 41.27 EUR
Getting API Credentials
To use the wrapper, you'll need Bricklink API credentials:
- Visit the Bricklink API page
- Accept the API Terms of Use
- Sign in or register on the consumer page
- Generate an access token with your external IP
- Use the provided credentials in your session object
Contributing
Contributions, bug reports, and feature requests are welcome! If you find issues or have ideas for improvements, please open an issue on GitHub.
License
This project is licensed under the GNU Affero General Public License (AGPL).
LEGO® is a trademark of the LEGO Group, which does not sponsor, authorize, or endorse this project.
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 bricklink_py-0.1.2b0.tar.gz.
File metadata
- Download URL: bricklink_py-0.1.2b0.tar.gz
- Upload date:
- Size: 28.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
14a3ef33718b3592d125f69d639c2f7d51970f1de997b995e965c3840b650d62
|
|
| MD5 |
bfbc88cbe74ab9901df89195108a3703
|
|
| BLAKE2b-256 |
48946ae50b900ba389f3399f7cd060b419f706e0b16880f5b2266420e2e4a9db
|
Provenance
The following attestation bundles were made for bricklink_py-0.1.2b0.tar.gz:
Publisher:
python-publish.yml on FrogCosmonaut/bricklink_py
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
bricklink_py-0.1.2b0.tar.gz -
Subject digest:
14a3ef33718b3592d125f69d639c2f7d51970f1de997b995e965c3840b650d62 - Sigstore transparency entry: 185788187
- Sigstore integration time:
-
Permalink:
FrogCosmonaut/bricklink_py@d0b0b60955b6c3871fda0c68519b6d99450b7270 -
Branch / Tag:
refs/tags/v0.1.2-beta - Owner: https://github.com/FrogCosmonaut
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@d0b0b60955b6c3871fda0c68519b6d99450b7270 -
Trigger Event:
release
-
Statement type:
File details
Details for the file bricklink_py-0.1.2b0-py3-none-any.whl.
File metadata
- Download URL: bricklink_py-0.1.2b0-py3-none-any.whl
- Upload date:
- Size: 26.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2a055f99bd421fc5779e07d731708c59b76e07dab7c8104a051adc08784af9e2
|
|
| MD5 |
fb90590a7654833e487c3eebb7448006
|
|
| BLAKE2b-256 |
11de788892e003f4b1b87aec347abbaf36ddb8087431a6224e1f19513c034dbb
|
Provenance
The following attestation bundles were made for bricklink_py-0.1.2b0-py3-none-any.whl:
Publisher:
python-publish.yml on FrogCosmonaut/bricklink_py
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
bricklink_py-0.1.2b0-py3-none-any.whl -
Subject digest:
2a055f99bd421fc5779e07d731708c59b76e07dab7c8104a051adc08784af9e2 - Sigstore transparency entry: 185788189
- Sigstore integration time:
-
Permalink:
FrogCosmonaut/bricklink_py@d0b0b60955b6c3871fda0c68519b6d99450b7270 -
Branch / Tag:
refs/tags/v0.1.2-beta - Owner: https://github.com/FrogCosmonaut
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@d0b0b60955b6c3871fda0c68519b6d99450b7270 -
Trigger Event:
release
-
Statement type: