DuetWebAPI
Python interface to Duet RepRap V3 firmware via Http REST API.
- Works over IP network.
- Does not support passwords on the printer.
- Supported boards:
- Duet 3 + SBC
- Duet 3 standalone
- Duet 2 standalone
Install
pip install duetwebapi
Alternatively:
pip install -e "git+https://github.com/AndyEveritt/DuetWebAPI.git@master#egg=duetwebapi"
Usage
- See 'examples.py' for examples.
from duetwebapi import DuetWebAPI
printer = DuetWebAPI(f'http://{printer_hostname}')
REST API
The REST API allows for the following operations:
| Method | Description |
|---|---|
get_model(key: str = None) -> Dict |
Get Duet object model. RRF3 only |
send_code(code: str) -> Dict |
Send G/M/T-code to Duet |
get_file(filename: str, directory: str = 'gcodes', binary: bool = False) -> str |
Download file from Duet |
upload_file(file: str | bytes | StringIO | TextIOWrapper | BytesIO, filename: str, directory: str = 'gcodes') -> Dict |
Upload file to Duet |
get_fileinfo(filename: str = None, directory: str = 'gcodes') -> Dict |
Get file info |
delete_file(filename: str, directory: str = 'gcodes') -> Dict |
Delete file on Duet |
move_file(from_path: str, to_path: str, force: bool = False) -> Dict |
Move file on Duet, can be used to rename files |
get_directory(directory: str) -> List[Dict] |
Get a list of all the files & directories in a directory |
create_directory(directory: str) -> Dict |
Create a new directory |
Wrapper
An additional wrapper is provided to make repetative tasks easier
| Method | Description |
|---|---|
emergency_stop() -> None |
Send M112 > M999 |
start_print(filename: str) -> Dict |
start a print on duet |
pause_print() -> Dict |
pause current print |
stop_print(leave_heaters: bool) -> Dict |
stop current print, will pause first if not paused |
get_coords() -> Dict |
return the current position of all the movement axes |
get_layer() -> int |
return the current layer number of the print |
get_num_extruders() -> int |
return the number of extruders currently configured |
get_num_tools() -> int |
return the number of tools currently configured |
get_status() -> str |
return the current Duet status |
get_temperature() -> List[Dict] |
return a list of all the analog sensors and their value |
get_current_tool() -> int |
return the current tool number |
get_messagebox() -> Dict |
return the details of a message displayed via M291 if one exists |
acknowledge_message(response: int) -> Dict |
send an acknowledgement to a message if one exists. Response options are 0 (continue), and 1 (cancel) |
Metadata
Release files for duetwebapi 1.2.2
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 |
|---|---|---|---|---|
| duetwebapi-1.2.2.tar.gz | 6.5 kB | Without provenance | Details for duetwebapi-1.2.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| duetwebapi-1.2.2-py3-none-any.whl | Python 3 | none | any | Details for duetwebapi-1.2.2-py3-none-any.whl |
Total release size: 14.9 kB
Release files / duetwebapi-1.2.2.tar.gz
| Download URL | duetwebapi-1.2.2.tar.gz |
|---|---|
| Size | 6.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5a1bcf481f955774987dfc85bceb48736ca9c5ca2126864654c230e435280b8e
|
|
BLAKE2b-256 checksum How to use checksums |
4af73db880ef3a6b918252cbabf2709e59bbf6c3e663977819fccc44d089e9e1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.8.5
|
Release files / duetwebapi-1.2.2-py3-none-any.whl
| Download URL | duetwebapi-1.2.2-py3-none-any.whl |
|---|---|
| Size | 8.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
bbee2c4171246250eec2cd9b26ae2f4c895f8882f48d226b6b6fc2eb9e319527
|
|
BLAKE2b-256 checksum How to use checksums |
e59e3664b220cc5d5217c81e1632d3038210ee1059e2b5600de37e1a66466557
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.8.5
|
Security for duetwebapi 1.2.2
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.