Skip to main content

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 printers
  • PrinterDiscovery: recommended discovery API
  • FlashForgeA4Client: documented TCP client for Adventurer 4 Lite / Pro printers
  • FlashForgeA3Client: documented TCP client for Adventurer 3 printers
  • FlashForgeTcpClient and client.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

flashforge_python_api-1.2.2.tar.gz (1.7 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

flashforge_python_api-1.2.2-py3-none-any.whl (76.4 kB view details)

Uploaded Python 3

File details

Details for the file flashforge_python_api-1.2.2.tar.gz.

File metadata

  • Download URL: flashforge_python_api-1.2.2.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

Hashes for flashforge_python_api-1.2.2.tar.gz
Algorithm Hash digest
SHA256 14bb73ad286491412368307f55933033e5008176ecdbd17c31f16a8be577371e
MD5 adaf14f57321bd00861b260e7c147fc8
BLAKE2b-256 e98697a6ce685b505d9d38ae377cc817ac965ffdb57d2298f9b379fbc56bec87

See more details on using hashes here.

File details

Details for the file flashforge_python_api-1.2.2-py3-none-any.whl.

File metadata

File hashes

Hashes for flashforge_python_api-1.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 3f8d59c28b1c004615209f5f2ec06b05bcbf9819294c41e3040670ba1a169d11
MD5 45ff51baf01d8459564fb29047e58eee
BLAKE2b-256 2f5c78d98ed06febe3c9873a3f300fc3e4bcd36111fe6776354694c6c1aee4f4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page