HPScanCLI
A modern, fast CLI tool for interacting with HP network scanners via standard eSCL (Apple AirScan) web protocol.
Features
- Device Discovery: Fast concurrent scanning across the local network to find active eSCL-compatible scanners.
- Config Persistence: Save your default scanner IP and scan preferences (
~/.config/hpscancli/config.json) so you don't need to specify--ipevery time. - Detailed Capabilities: Inspect supported color modes, resolutions (DPI), document formats, and ADF support.
- Multi-Format Scanning: Scan directly to PDF, PNG, or JPEG with configurable dimensions, resolution, and color modes.
- File Safety: Pre-flight checks prevent accidental file overwrites (override with
-w/--overwrite). - Bulk Scanning: Continuously scan sequential pages (
doc_1,doc_2, ...) without re-invoking the command. - Zero Heavy XML Dependencies: Uses Python's built-in
xml.etree.ElementTreeinstead ofbs4. - Modern Standards: Built with PEP 621 (
pyproject.toml) and managed viapipx.
Installation
Install globally in an isolated environment using pipx:
pipx install git+https://github.com/prasannareddych/hpscancli.git
Or install from a local clone:
git clone https://github.com/prasannareddych/hpscancli.git
cd hpscancli
pipx install .
Configuration
You can persist your default scanner IP and scan preferences (~/.config/hpscancli/config.json) so you don't need to specify them every time:
# View all current settings
hpscancli config show
# Set scanner IP
hpscancli config set ip 192.168.0.105
# Set default scan resolution, format, and color mode
hpscancli config set dpi 300
hpscancli config set format pdf # pdf, png, jpeg
hpscancli config set colormode color # color, bw
# Read a specific key
hpscancli config get ip
# Reset settings to defaults
hpscancli config reset
Usage
hpscancli [command] [options]
Commands
| Command | Description |
|---|---|
scan |
Execute a single scan job |
bulkscan |
Continuously scan multiple pages interactively |
config |
Manage persistent scanner configuration (show, get, set, reset) |
Options
| Flag / Option | Description |
|---|---|
-i, --ip <IP> |
Target scanner IP (overrides persisted config) |
-s, --search |
Search for candidate scanners on the local subnet |
-c, --capabilities |
Show scanner hardware capabilities and exit |
-o, --output, --filename <PATH> |
Output file name / path (e.g. doc1 or doc1.png) |
-w, --overwrite |
Overwrite destination file if it already exists |
--pdf |
Save scan as PDF document (default) |
--png |
Save scan as PNG image (converts with Pillow if device lacks native PNG) |
--jpeg / --jpg |
Save scan as JPEG image |
--dpi <DPI> |
Scan resolution (e.g., 75, 150, 300, 600). Fails if unsupported. |
--colormode <MODE> |
color (RGB24) or bw (Grayscale8) |
--width <WIDTH> |
Custom scan width in pixels/units |
--height <HEIGHT> |
Custom scan height in pixels/units |
-b, --bulk |
Enable interactive bulk/continuous scanning |
--split |
Save bulk scan pages as separate files instead of merging into a single PDF |
Examples
-
Discover scanners on the network:
hpscancli -s -
Save scanner IP and preferences:
hpscancli config set ip 192.168.0.105 hpscancli config set dpi 300
-
Check scanner capabilities:
hpscancli -c -
Scan to PDF (default settings):
hpscancli scan -o invoice
-
Scan to PNG (safe overwrite protection):
hpscancli scan --png -o photo # If photo.png already exists, it errors safely. # To force overwrite: hpscancli scan --png -o photo --overwrite
-
Scan high-res color photo to JPEG:
hpscancli scan --dpi 600 --colormode color --jpeg -o portrait
-
Continuous multi-page bulk scan (merged into a single PDF):
hpscancli bulkscan -o contract # Prompts after each page and merges all pages into contract.pdf
-
Bulk scan saved as separate individual files:
hpscancli bulkscan -o contract --split # Saves contract.pdf, contract_2.pdf, contract_3.pdf...
Architecture & Codebase
hpscancli/config.py: Persistent JSON configuration manager.hpscancli/client.py: eSCL client handling scan jobs, status polling, and stream downloads.hpscancli/discovery.py: Concurrent network device discovery.hpscancli/schema.py: Standard library ElementTree XML parser and eSCL payload generator.hpscancli/models.py: Clean dataclasses for capabilities and scan options.hpscancli/cli.py: Modern command line interface.tests/test_scanner.py: Pytest unit test suite.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Metadata
Release files for hpscancli 1.1.0
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 | |
|---|---|---|---|---|
| hpscancli-1.1.0.tar.gz | 18.9 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| hpscancli-1.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 37.5 kB
Release files / hpscancli-1.1.0.tar.gz
| Download URL | hpscancli-1.1.0.tar.gz |
|---|---|
| Size | 18.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
651e790bda253b42ea0bb7a8cfb40e6c851d2e87a19a2b2d479feee5ab08da9a
|
|
BLAKE2b-256 checksum How to use checksums |
db9c6f8c47af237b27a8f312c046e8c33a77cc07df465b0ad61dadb5d0315434
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.15
|
Release files / hpscancli-1.1.0-py3-none-any.whl
| Download URL | hpscancli-1.1.0-py3-none-any.whl |
|---|---|
| Size | 18.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e99ced2f1483e827cebc1807f61871c2b41b5d7c8be7ffe953bcfbf697daebd7
|
|
BLAKE2b-256 checksum How to use checksums |
6fef65d47a8001e4ce37e1a5593fdd7a652ba9ce6f41a773d21ff9e43f056bef
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.15
|
Security for hpscancli 1.1.0
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.