Bambulabs API
This package provides a Python API for interacting with BambuLab 3D Printers. The API enables you to control and monitor your printer programmatically, making it an essential tool for developers, makers, and automation enthusiasts. The project is open-source and available on PyPI.
Support
If you've found this package useful, help us support more printers with the link below.
Status
Documentation
Comprehensive documentation for this package, including API reference and usage guides, can be found here.
Installation
To install the package, use pip:
pip install bambulabs_api
Make sure you have Python 3.10 or higher installed.
Features
- Connect and control BambuLab 3D printers programmatically.
- Monitor printer status in real-time.
- Execute commands and manage print jobs directly through Python code.
- Easy setup and integration with Python environments.
Usage Example
Below is a basic example demonstrating how to connect to a BambuLab 3D printer and retrieve its status using the API:
import time
import bambulabs_api as bl
IP = '192.168.1.200'
SERIAL = 'AC12309BH109'
ACCESS_CODE = '12347890'
if __name__ == '__main__':
print('Starting bambulabs_api example')
print('Connecting to BambuLab 3D printer')
print(f'IP: {IP}')
print(f'Serial: {SERIAL}')
print(f'Access Code: {ACCESS_CODE}')
# Create a new instance of the API
printer = bl.Printer(IP, ACCESS_CODE, SERIAL)
# Connect to the BambuLab 3D printer
printer.connect()
time.sleep(2)
# Get the printer status
status = printer.get_state()
print(f'Printer status: {status}')
# Turn the light off
printer.turn_light_off()
time.sleep(2)
# Turn the light on
printer.turn_light_on()
# Disconnect from the Bambulabs 3D printer
printer.disconnect()
Known Limitations
- X1 Printers are not fully supported yet - camera integration is not yet implemented (for api versions < 2.7.0 please see the No Camera Example).
- H2D printers have not been tested yet.
Development
If you want to contribute to the development of this API or run it in a development environment, follow these steps:
Prerequisites
- Conda: Make sure you have Conda installed on your system.
- Git: Ensure Git is installed for cloning the repository.
Setup
-
Clone the repository:
git clone https://github.com/BambuTools/bambulabs_api.git
-
Change directory:
cd bambulabs_api
-
Create the Conda environment using the provided
environment.ymlfile:conda env create -f environment.yml
Note: Apple M chip workaround The binary for myst_parser is not available for M1 devices yet, as a workaround
- Delete myst_parser from environment.yml
- run
conda env create -f environment.yml - Execute step 4 then run
pip install myst_parser
-
Activate the environment:
conda activate bl_api
-
Install the package in development mode:
pip install -e .
Running Tests
To ensure everything is working correctly, you can run the tests using pytest:
pytest
Contributing
Contributions are welcome! If you'd like to contribute to this project, please:
- Fork the repository.
- Create a new branch (
git checkout -b feature-branch). - Commit your changes (
git commit -am 'Add new feature'). - Push to the branch (
git push origin feature-branch). - Open a pull request.
Please make sure your code follows PEP 8 guidelines and that you run tests before submitting a PR.
License
This project is licensed under the MIT License. See the LICENSE file for more details.
Support
If you encounter any issues or have questions, feel free to open an issue on the GitHub repository.
Acknowledgements
This package is an open-source project developed and maintained by the community. Special thanks to all contributors who have helped improve and enhance this API.
Metadata
Release files for bambulabs-api 2.6.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| bambulabs_api-2.6.6.tar.gz | 36.0 kB | Without provenance | Details for bambulabs_api-2.6.6.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| bambulabs_api-2.6.6-py3-none-any.whl | Python 3 | none | any | Details for bambulabs_api-2.6.6-py3-none-any.whl |
Total release size: 62.8 kB
Release files / bambulabs_api-2.6.6.tar.gz
| Download URL | bambulabs_api-2.6.6.tar.gz |
|---|---|
| Size | 36.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
69aff2da11d460807ddf8ef4d9afdd5e5a625366cef7c6103f0060c3cd7cc13c
|
|
BLAKE2b-256 checksum How to use checksums |
b5cf67c41d13db19ad3cdefdb620157460250666926725607604add678d1dfac
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Release files / bambulabs_api-2.6.6-py3-none-any.whl
| Download URL | bambulabs_api-2.6.6-py3-none-any.whl |
|---|---|
| Size | 26.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f1dff54bdd328b98c00925376c886d4a8b8b57811a475e4e55ed71340572bb09
|
|
BLAKE2b-256 checksum How to use checksums |
7591a4183ae0e8e4ce4f88ed027a6e5471f9de7f63ceadc65a21a63ba7dbbc94
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Security for bambulabs-api 2.6.6
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.