A comprehensive Python library for controlling FlashForge 3D printers
Project description
FlashForge Python API
Python library for controlling FlashForge 3D printers with async support for the modern HTTP API and the legacy TCP protocol.
Supported Printers
| Printer | Support |
|---|---|
| Adventurer 5M | Full |
| Adventurer 5M Pro | Full |
| AD5X | Full |
| Adventurer 3 / 4 | Dedicated TCP clients |
Installation
pip install flashforge-python-api
Quick Start
Modern LAN-mode HTTP printers require:
- printer IP address
- serial number
- check code (per-printer credential, not returned by discovery)
import asyncio
import os
from flashforge import FlashForgeClient, FiveMClientConnectionOptions, PrinterDiscovery
async def main():
check_code = os.getenv("FLASHFORGE_CHECK_CODE", "").strip()
if not check_code:
print("Set FLASHFORGE_CHECK_CODE before running this example")
return
discovery = PrinterDiscovery()
printers = await discovery.discover()
if not printers:
print("No printers found")
return
printer = printers[0]
if not printer.serial_number:
print("Discovered printer did not report a serial number")
return
options = FiveMClientConnectionOptions(
http_port=printer.event_port,
tcp_port=printer.command_port,
)
async with FlashForgeClient(
printer.ip_address,
printer.serial_number,
check_code,
options=options,
) as client:
status = await client.get_printer_status()
if not status:
return
await client.init_control()
status = await client.get_printer_status()
print(f"Printer: {client.printer_name}")
print(f"State: {status.machine_state if status else 'unknown'}")
await client.control.home_axes()
asyncio.run(main())
Main Entry Points
FlashForgeClient: primary client for modern printersPrinterDiscovery: recommended discovery APIFlashForgeA4Client: documented TCP client for Adventurer 4 Lite / Pro printersFlashForgeA3Client: documented TCP client for Adventurer 3 printersFlashForgeTcpClientandclient.tcp_client: lower-level TCP access for direct commands and generic legacy workflows
Capabilities
- printer discovery
- printer status and machine information
- job control
- file listing, uploads, and thumbnails
- temperature and motion control
- LED, camera, and filtration control where supported
- AD5X-specific job and material-station support
Documentation
Project details
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 flashforge_python_api-1.2.3.tar.gz.
File metadata
- Download URL: flashforge_python_api-1.2.3.tar.gz
- Upload date:
- Size: 1.7 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5646ea057ac73634183f9328553f3cc79537de9a5e0c38a6b6b6473c57e55bb4
|
|
| MD5 |
03f3ff5c9c4e907942df62f760c70e73
|
|
| BLAKE2b-256 |
8a1317695e71ce7e47fb96577ed8b8810c88f48fa1acc894d6cf571368c46c1b
|
File details
Details for the file flashforge_python_api-1.2.3-py3-none-any.whl.
File metadata
- Download URL: flashforge_python_api-1.2.3-py3-none-any.whl
- Upload date:
- Size: 76.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
201f6709e230120efbbbf496e758c43a1f355b45abf41161d0d0a68bf5ca976f
|
|
| MD5 |
5b1b9705841b1ea1ad99927f382b545a
|
|
| BLAKE2b-256 |
87621faf7bf01ef0ec8f4d2eb91fd03ec280c834bdf1e46ccede648c7b3a58a5
|