zebra-day 0.0.32__py3-none-any.whl → 1.0.2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- zebra_day/__init__.py +35 -0
- zebra_day/bin/fetch_zebra_config.py +15 -0
- zebra_day/bin/generate_coord_grid_zpl.py +50 -0
- zebra_day/bin/print_zpl_from_file.py +21 -0
- zebra_day/bin/probe_new_label_dimensions.py +75 -0
- zebra_day/bin/scan_for_networed_zebra_printers_curl.sh +2 -1
- zebra_day/bin/zserve.py +701 -259
- zebra_day/cli/__init__.py +240 -0
- zebra_day/cli/cognito.py +121 -0
- zebra_day/cli/gui.py +255 -0
- zebra_day/cli/printer.py +168 -0
- zebra_day/cli/template.py +176 -0
- zebra_day/cmd_mgr.py +35 -0
- zebra_day/etc/label_styles/blank.zpl +0 -0
- zebra_day/etc/label_styles/cornersStripOf4Squares_1inX1in.zpl +55 -0
- zebra_day/etc/label_styles/corners_1inX2in.zpl +28 -0
- zebra_day/etc/label_styles/corners_20cmX30cm.zpl +6 -0
- zebra_day/etc/label_styles/corners_smallTube.zpl +7 -0
- zebra_day/etc/label_styles/corners_unspecifiedDimensions.zpl +15 -0
- zebra_day/etc/label_styles/plate_1inX0.25inHD.zpl +9 -0
- zebra_day/etc/label_styles/smallTubeWdotHD_prod.zpl +8 -0
- zebra_day/etc/label_styles/smallTubeWdot_corners.zpl +7 -0
- zebra_day/etc/label_styles/smallTubeWdot_prod.zpl +8 -0
- zebra_day/etc/label_styles/smallTubeWdot_prodAlt1.zpl +6 -0
- zebra_day/etc/label_styles/smallTubeWdot_prodAlt1b.zpl +3 -0
- zebra_day/etc/label_styles/smallTubeWdot_prodV2.zpl +8 -0
- zebra_day/etc/label_styles/smallTubeWdot_reagent.zpl +29 -0
- zebra_day/etc/label_styles/stripOf4Squares_1inX1in.zpl +32 -0
- zebra_day/etc/label_styles/test_800dX800dCoordinateArray.zpl +1 -0
- zebra_day/etc/label_styles/tmps/tmp_zpl_templates.here +0 -0
- zebra_day/etc/label_styles/tube_20mmX30mmA.zpl +7 -0
- zebra_day/etc/label_styles/tube_2inX0.5in.zpl +15 -0
- zebra_day/etc/label_styles/tube_2inX0.5inHD.zpl +15 -0
- zebra_day/etc/label_styles/tube_2inX1inHD.zpl +22 -0
- zebra_day/etc/label_styles/tube_2inX1inHDv3.zpl +21 -0
- zebra_day/etc/old_printer_config/2026-02-01_01:50:25.022846_printer_config.json +1 -0
- zebra_day/etc/old_printer_config/2026-02-01_01:50:25.033657_printer_config.json +1 -0
- zebra_day/etc/old_printer_config/2026-02-01_01:50:25.039597_printer_config.json +3 -0
- zebra_day/etc/old_printer_config/2026-02-01_01:50:25.047295_printer_config.json +1 -0
- zebra_day/etc/old_printer_config/2026-02-01_01:50:25.055804_printer_config.json +1 -0
- zebra_day/etc/old_printer_config/2026-02-01_01:50:25.061337_printer_config.json +3 -0
- zebra_day/etc/old_printer_config/2026-02-01_01:51:24.073326_printer_config.json +1 -0
- zebra_day/etc/old_printer_config/2026-02-01_01:51:24.081950_printer_config.json +1 -0
- zebra_day/etc/old_printer_config/2026-02-01_01:51:24.088251_printer_config.json +3 -0
- zebra_day/etc/old_printer_config/2026-02-01_01:51:24.096501_printer_config.json +1 -0
- zebra_day/etc/old_printer_config/2026-02-01_01:51:24.104767_printer_config.json +1 -0
- zebra_day/etc/old_printer_config/2026-02-01_01:51:24.110364_printer_config.json +3 -0
- zebra_day/etc/old_printer_config/2026-02-01_01:51:24.118239_printer_config.json +1 -0
- zebra_day/etc/old_printer_config/2026-02-01_01:51:24.125950_printer_config.json +1 -0
- zebra_day/etc/old_printer_config/2026-02-01_01:51:24.349866_printer_config.json +1 -0
- zebra_day/etc/old_printer_config/2026-02-01_01:51:24.361085_printer_config.json +3 -0
- zebra_day/etc/old_printer_config/2026-02-01_01:51:24.558323_printer_config.json +1 -0
- zebra_day/etc/old_printer_config/2026-02-01_01:51:24.565756_printer_config.json +3 -0
- zebra_day/etc/old_printer_config/{2023-10-25_02:19:04.139607_printer_config.json → 2026-02-01_01:51:29.739070_printer_config.json} +4 -3
- zebra_day/etc/old_printer_config/2026-02-01_01:51:29.753796_printer_config.json +1 -0
- zebra_day/etc/old_printer_config/2026-02-01_01:51:29.760201_printer_config.json +3 -0
- zebra_day/etc/old_printer_config/2026-02-01_01:51:29.768747_printer_config.json +1 -0
- zebra_day/etc/old_printer_config/2026-02-01_01:51:29.775312_printer_config.json +3 -0
- zebra_day/etc/old_printer_config/2026-02-01_01:51:29.782533_printer_config.json +1 -0
- zebra_day/etc/old_printer_config/2026-02-01_01:51:29.789287_printer_config.json +1 -0
- zebra_day/etc/old_printer_config/2026-02-01_01:51:29.794230_printer_config.json +3 -0
- zebra_day/etc/old_printer_config/2026-02-01_01:51:29.800021_printer_config.json +5 -0
- zebra_day/etc/printer_config.json +3 -54
- zebra_day/etc/printer_config.template.json +3 -2
- zebra_day/etc/tmp_printers0.json +5 -0
- zebra_day/etc/tmp_printers374.json +5 -0
- zebra_day/etc/tmp_printers383.json +5 -0
- zebra_day/etc/tmp_printers450.json +5 -0
- zebra_day/etc/tmp_printers504.json +5 -0
- zebra_day/etc/tmp_printers608.json +5 -0
- zebra_day/etc/tmp_printers657.json +5 -0
- zebra_day/etc/tmp_printers838.json +5 -0
- zebra_day/etc/tmp_printers839.json +5 -0
- zebra_day/etc/tmp_printers933.json +5 -0
- zebra_day/etc/tmp_printers957.json +5 -0
- zebra_day/exceptions.py +88 -0
- zebra_day/files/hold +0 -0
- zebra_day/files/test_png_17696.png +0 -0
- zebra_day/files/test_png_23477.png +0 -0
- zebra_day/files/test_png_28157.png +0 -0
- zebra_day/files/test_png_35832.png +0 -0
- zebra_day/files/test_png_36400.png +0 -0
- zebra_day/files/test_png_40816.png +0 -0
- zebra_day/files/test_png_49564.png +0 -0
- zebra_day/files/test_png_53848.png +0 -0
- zebra_day/files/test_png_62542.png +0 -0
- zebra_day/files/test_png_91597.png +0 -0
- zebra_day/files/test_png_93633.png +0 -0
- zebra_day/files/tmpbjo3k7q1.png +0 -0
- zebra_day/files/tmpigtr4pwy.png +0 -0
- zebra_day/files/zpl_label_tube_2inX1in_2026-02-01_01:51:24.370964.png +0 -0
- zebra_day/logging_config.py +74 -0
- zebra_day/logs/.hold +0 -0
- zebra_day/logs/print_requests.log +2 -0
- zebra_day/paths.py +143 -0
- zebra_day/print_mgr.py +489 -103
- zebra_day/static/datschund.css +63 -43
- zebra_day/static/datschund.png +0 -0
- zebra_day/static/daylily.png +0 -0
- zebra_day/static/favicon.svg +20 -0
- zebra_day/static/general.css +99 -0
- zebra_day/static/js/zebra_modern.js +172 -0
- zebra_day/static/lsmc.css +354 -0
- zebra_day/static/moon.jpeg +0 -0
- zebra_day/static/oakland.css +0 -32
- zebra_day/static/popday_daylily.css +1 -1
- zebra_day/static/style.css +39 -0
- zebra_day/static/zebra_modern.css +771 -0
- zebra_day/templates/base.html +36 -0
- zebra_day/templates/bpr.html +72 -0
- zebra_day/templates/build_new_config.html +36 -0
- zebra_day/templates/build_print_request.html +32 -0
- zebra_day/templates/chg_ui_style.html +19 -0
- zebra_day/templates/edit_template.html +128 -0
- zebra_day/templates/edit_zpl.html +37 -0
- zebra_day/templates/index.html +82 -0
- zebra_day/templates/legacy/base.html +37 -0
- zebra_day/templates/legacy/bpr.html +72 -0
- zebra_day/templates/legacy/build_new_config.html +36 -0
- zebra_day/templates/legacy/build_print_request.html +32 -0
- zebra_day/templates/legacy/chg_ui_style.html +19 -0
- zebra_day/templates/legacy/edit_template.html +128 -0
- zebra_day/templates/legacy/edit_zpl.html +37 -0
- zebra_day/templates/legacy/index.html +82 -0
- zebra_day/templates/legacy/list_prior_configs.html +24 -0
- zebra_day/templates/legacy/print_result.html +30 -0
- zebra_day/templates/legacy/printer_details.html +25 -0
- zebra_day/templates/legacy/printer_status.html +70 -0
- zebra_day/templates/legacy/save_result.html +17 -0
- zebra_day/templates/legacy/send_print_request.html +34 -0
- zebra_day/templates/legacy/simple_print.html +94 -0
- zebra_day/templates/legacy/view_pstation_json.html +29 -0
- zebra_day/templates/list_prior_configs.html +24 -0
- zebra_day/templates/modern/base.html +98 -0
- zebra_day/templates/modern/config.html +141 -0
- zebra_day/templates/modern/dashboard.html +160 -0
- zebra_day/templates/modern/print_request.html +141 -0
- zebra_day/templates/modern/print_result.html +88 -0
- zebra_day/templates/modern/printer_detail.html +117 -0
- zebra_day/templates/modern/printers.html +133 -0
- zebra_day/templates/modern/save_result.html +46 -0
- zebra_day/templates/modern/template_editor.html +172 -0
- zebra_day/templates/modern/templates.html +122 -0
- zebra_day/templates/print_result.html +30 -0
- zebra_day/templates/printer_details.html +25 -0
- zebra_day/templates/printer_status.html +70 -0
- zebra_day/templates/save_result.html +17 -0
- zebra_day/templates/send_print_request.html +34 -0
- zebra_day/templates/simple_print.html +94 -0
- zebra_day/templates/view_pstation_json.html +29 -0
- zebra_day/web/__init__.py +9 -0
- zebra_day/web/app.py +171 -0
- zebra_day/web/auth.py +172 -0
- zebra_day/web/middleware.py +159 -0
- zebra_day/web/routers/__init__.py +2 -0
- zebra_day/web/routers/api.py +163 -0
- zebra_day/web/routers/ui.py +1051 -0
- zebra_day/zpl_renderer.py +273 -0
- zebra_day-1.0.2.dist-info/METADATA +786 -0
- zebra_day-1.0.2.dist-info/RECORD +179 -0
- {zebra_day-0.0.32.dist-info → zebra_day-1.0.2.dist-info}/WHEEL +1 -1
- zebra_day-1.0.2.dist-info/entry_points.txt +4 -0
- zebra_day/etc/.blind +0 -1
- zebra_day/etc/current_style.txt +0 -1
- zebra_day/etc/label_styles/test_2inX1in.zpl +0 -22
- zebra_day/etc/label_styles/tmps/labware_2inX1in.na.2023-10-24_12:49:21.045127.zpl +0 -21
- zebra_day/etc/label_styles/tmps/labware_2inX1in.naggg.2023-10-24_16:02:04.704814.8888.2023-10-24_16:02:16.443911.zpl +0 -21
- zebra_day/etc/label_styles/tmps/labware_2inX1in.naggg.2023-10-24_16:02:04.704814.zpl +0 -21
- zebra_day/etc/label_styles/tmps/test_2inX1in.na.2023-10-24_12:45:37.002774.zpl +0 -22
- zebra_day/etc/old_printer_config/2023-10-24_16:06:06.931764_printer_config.json +0 -67
- zebra_day/etc/printer_config.json~ +0 -67
- zebra_day/files/tmp_2olihg4.png +0 -0
- zebra_day/files/tmpveojoyvn.png +0 -0
- zebra_day/files/zpl_label_labware_2inX1in_2023-10-25_02:30:08.093631.png +0 -0
- zebra_day/files/zpl_label_test_2inX1in_2023-10-24_15:54:29.343124.png +0 -0
- zebra_day/files/zpl_label_test_2inX1in_2023-10-24_16:01:45.670132.png +0 -0
- zebra_day/static/beyonce.css +0 -227
- zebra_day/static/datschund_on_moon.css +0 -164
- zebra_day/static/medicalsci.css +0 -144
- zebra_day/static/moar_zebra.css +0 -133
- zebra_day/static/popday.css +0 -140
- zebra_day/static/popday_dark.css +0 -140
- zebra_day/static/popday_dog.css +0 -140
- zebra_day-0.0.32.dist-info/METADATA +0 -14
- zebra_day-0.0.32.dist-info/RECORD +0 -53
- zebra_day-0.0.32.dist-info/entry_points.txt +0 -2
- /zebra_day/{etc/label_styles/blank_0inX0in.zpl → bin/__init__.py} +0 -0
- /zebra_day/etc/label_styles/{labware_2inX1in.zpl → generic_2inX1in.zpl} +0 -0
- {zebra_day-0.0.32.dist-info → zebra_day-1.0.2.dist-info/licenses}/LICENSE +0 -0
- {zebra_day-0.0.32.dist-info → zebra_day-1.0.2.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,786 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: zebra_day
|
|
3
|
+
Version: 1.0.2
|
|
4
|
+
Summary: A Python library to manage a Zebra printer fleet and an API for ZPL print requests.
|
|
5
|
+
Home-page: https://github.com/Daylily-Informatics/zebra_day
|
|
6
|
+
Author: John Major
|
|
7
|
+
Author-email: John Major <john@daylilyinformatics.com>
|
|
8
|
+
License: MIT
|
|
9
|
+
Project-URL: Homepage, https://github.com/Daylily-Informatics/zebra_day
|
|
10
|
+
Project-URL: Repository, https://github.com/Daylily-Informatics/zebra_day.git
|
|
11
|
+
Project-URL: Issues, https://github.com/Daylily-Informatics/zebra_day/issues
|
|
12
|
+
Keywords: zebra,printer,zpl,label,barcode,fleet
|
|
13
|
+
Classifier: Development Status :: 4 - Beta
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: Intended Audience :: Manufacturing
|
|
16
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
17
|
+
Classifier: Operating System :: OS Independent
|
|
18
|
+
Classifier: Programming Language :: Python :: 3
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
23
|
+
Classifier: Topic :: Printing
|
|
24
|
+
Classifier: Topic :: System :: Hardware
|
|
25
|
+
Requires-Python: >=3.10
|
|
26
|
+
Description-Content-Type: text/markdown
|
|
27
|
+
License-File: LICENSE
|
|
28
|
+
Requires-Dist: yaml-config-day>=0.0.5
|
|
29
|
+
Requires-Dist: requests>=2.28.0
|
|
30
|
+
Requires-Dist: pytz>=2023.3
|
|
31
|
+
Requires-Dist: fastapi>=0.109.0
|
|
32
|
+
Requires-Dist: uvicorn[standard]>=0.27.0
|
|
33
|
+
Requires-Dist: jinja2>=3.1.0
|
|
34
|
+
Requires-Dist: pydantic>=2.0.0
|
|
35
|
+
Requires-Dist: python-multipart>=0.0.6
|
|
36
|
+
Requires-Dist: typer>=0.9.0
|
|
37
|
+
Requires-Dist: rich>=13.0.0
|
|
38
|
+
Requires-Dist: pillow>=10.0.0
|
|
39
|
+
Requires-Dist: zint-bindings>=1.2.0
|
|
40
|
+
Provides-Extra: dev
|
|
41
|
+
Requires-Dist: pytest>=7.4.0; extra == "dev"
|
|
42
|
+
Requires-Dist: pytest-cov>=4.0.0; extra == "dev"
|
|
43
|
+
Requires-Dist: ipython>=8.16.0; extra == "dev"
|
|
44
|
+
Provides-Extra: lint
|
|
45
|
+
Requires-Dist: black>=23.0.0; extra == "lint"
|
|
46
|
+
Requires-Dist: ruff>=0.1.0; extra == "lint"
|
|
47
|
+
Requires-Dist: mypy>=1.0.0; extra == "lint"
|
|
48
|
+
Provides-Extra: docs
|
|
49
|
+
Requires-Dist: mkdocs>=1.5.0; extra == "docs"
|
|
50
|
+
Requires-Dist: mkdocs-material>=9.0.0; extra == "docs"
|
|
51
|
+
Provides-Extra: auth
|
|
52
|
+
Requires-Dist: daylily-cognito>=0.1.10; extra == "auth"
|
|
53
|
+
Requires-Dist: python-jose[cryptography]>=3.3.0; extra == "auth"
|
|
54
|
+
Requires-Dist: boto3>=1.26.0; extra == "auth"
|
|
55
|
+
Provides-Extra: all
|
|
56
|
+
Requires-Dist: zebra_day[auth,dev,docs,lint]; extra == "all"
|
|
57
|
+
Dynamic: author
|
|
58
|
+
Dynamic: home-page
|
|
59
|
+
Dynamic: license-file
|
|
60
|
+
|
|
61
|
+
<img src=zebra_day/imgs/bar_red.png>
|
|
62
|
+
|
|
63
|
+
## zebra_day Overview [1.0.2](https://github.com/Daylily-Informatics/zebra_day/releases/tag/1.0.2)
|
|
64
|
+
|
|
65
|
+
### Build, Deploy, Run, Monitor, Teardown
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
# Build & Install (development mode)
|
|
69
|
+
pip install -e ".[dev]"
|
|
70
|
+
|
|
71
|
+
# Activate environment (for development)
|
|
72
|
+
source zday_activate # Sets up env, installs package, enables tab completion
|
|
73
|
+
|
|
74
|
+
# Run Tests
|
|
75
|
+
pytest -v
|
|
76
|
+
|
|
77
|
+
# Run Linting (requires pip install -e ".[lint]")
|
|
78
|
+
ruff check zebra_day tests
|
|
79
|
+
black --check zebra_day tests
|
|
80
|
+
mypy zebra_day --ignore-missing-imports
|
|
81
|
+
|
|
82
|
+
# CLI Commands (new in 0.6.0)
|
|
83
|
+
zday --help # Show all commands
|
|
84
|
+
zday bootstrap # First-time setup: scan for printers
|
|
85
|
+
zday gui start # Start web UI in background
|
|
86
|
+
zday gui stop # Stop web UI
|
|
87
|
+
zday gui status # Check if web UI is running
|
|
88
|
+
|
|
89
|
+
# Health Checks
|
|
90
|
+
curl http://localhost:8118/healthz # Basic health check
|
|
91
|
+
curl http://localhost:8118/readyz # Readiness check (printer mgr initialized)
|
|
92
|
+
|
|
93
|
+
# API Documentation
|
|
94
|
+
# Visit http://localhost:8118/docs for interactive OpenAPI docs
|
|
95
|
+
# Visit http://localhost:8118/redoc for alternative API documentation
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
<ul>
|
|
99
|
+
|
|
100
|
+
<table border="1" >
|
|
101
|
+
<tr >
|
|
102
|
+
<td > * auto discovery * of networked printers</td>
|
|
103
|
+
<td> ui configurable printer fleet details</td>
|
|
104
|
+
<td >zpl template drafting & live ui preview </td>
|
|
105
|
+
</tr>
|
|
106
|
+
<tr >
|
|
107
|
+
<td>monitor printer fleet status in one dashboard</td>
|
|
108
|
+
<td >simple and powerful python package offers ability to include barcode label printing in other s/w systems</td>
|
|
109
|
+
<td>fast and straight forward deployment and maintaince</td>
|
|
110
|
+
</tr>
|
|
111
|
+
<tr >
|
|
112
|
+
<td >directly access each printers admin console</td>
|
|
113
|
+
<td >integrate with other systems (Salesforce, AWS)</td>
|
|
114
|
+
<td > simple print API endpoints <hr>(commercial alternatives are quite expensive, and often offer less)</td>
|
|
115
|
+
</tr>
|
|
116
|
+
</table>
|
|
117
|
+
</ul>
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
<hr>
|
|
121
|
+
|
|
122
|
+
#### For The Impatient
|
|
123
|
+
|
|
124
|
+
<ul>
|
|
125
|
+
* Verify there are zebra printers connected & powered up to the same network that the PC you are installing this s/w to is connected.
|
|
126
|
+
|
|
127
|
+
```bash
|
|
128
|
+
python --version # should be 3.10+ # advisable to run in some kind of venv
|
|
129
|
+
|
|
130
|
+
pip install zebra_day
|
|
131
|
+
|
|
132
|
+
# You should load a fresh env / open a fresh terminal so the package is available
|
|
133
|
+
|
|
134
|
+
# First-time setup: scan network for printers and initialize configuration
|
|
135
|
+
zday bootstrap
|
|
136
|
+
|
|
137
|
+
# Start the web UI (runs in background)
|
|
138
|
+
zday gui start
|
|
139
|
+
# Web UI available at http://0.0.0.0:8118
|
|
140
|
+
|
|
141
|
+
# Or start in foreground (for debugging)
|
|
142
|
+
zday gui start --foreground
|
|
143
|
+
|
|
144
|
+
# Check status
|
|
145
|
+
zday gui status
|
|
146
|
+
zday info
|
|
147
|
+
|
|
148
|
+
# Stop the server
|
|
149
|
+
zday gui stop
|
|
150
|
+
```
|
|
151
|
+
<ul>
|
|
152
|
+
<a href=zebra_day/docs/zebra_day_ui_guide.md ><hr></a>
|
|
153
|
+
|
|
154
|
+
> <a href=zebra_day/docs/zebra_day_ui_guide.md >ui capabilities full details</a>
|
|
155
|
+
|
|
156
|
+
#### Some UI Niceties
|
|
157
|
+
##### Zebra Printer Fleet Dashboard
|
|
158
|
+
<img width="400" alt="fleetreport" src="https://github.com/Daylily-Informatics/zebra_day/assets/4713659/8a66bc11-f8f5-4c40-9970-36d554a4593a">
|
|
159
|
+
|
|
160
|
+
##### Zebra Printer, Single Printer Detail View
|
|
161
|
+
<img width="690" alt="Screenshot 2023-11-01 at 1 35 36 AM" src="https://github.com/Daylily-Informatics/zebra_day/assets/4713659/7438df35-9e92-474e-a2ef-57d3c3ee23d7">
|
|
162
|
+
|
|
163
|
+
##### ZPL Label Editing IRT
|
|
164
|
+
<img width="345" alt="zpl_editing" src="https://github.com/Daylily-Informatics/zebra_day/assets/4713659/15aac332-c5f8-4ce6-be6c-9c403fd8d35d">
|
|
165
|
+
|
|
166
|
+
</ul>
|
|
167
|
+
|
|
168
|
+
### CLI Reference (0.6.0+)
|
|
169
|
+
|
|
170
|
+
The `zday` CLI provides a comprehensive interface for managing your Zebra printer fleet.
|
|
171
|
+
|
|
172
|
+
```bash
|
|
173
|
+
# Get help on any command
|
|
174
|
+
zday --help
|
|
175
|
+
zday gui --help
|
|
176
|
+
zday printer --help
|
|
177
|
+
|
|
178
|
+
# Core commands
|
|
179
|
+
zday info # Show version, config paths, server status
|
|
180
|
+
zday status # Show printer fleet status, service health
|
|
181
|
+
zday bootstrap # First-time setup: scan network, initialize config
|
|
182
|
+
|
|
183
|
+
# GUI server management
|
|
184
|
+
zday gui start [--auth none|cognito] [--host HOST] [--port PORT]
|
|
185
|
+
zday gui stop
|
|
186
|
+
zday gui status
|
|
187
|
+
zday gui logs [--tail N] [--follow]
|
|
188
|
+
zday gui restart
|
|
189
|
+
|
|
190
|
+
# Printer management
|
|
191
|
+
zday printer scan [--ip-stub IP] # Scan network for printers
|
|
192
|
+
zday printer list [--lab LAB] # List configured printers
|
|
193
|
+
zday printer test PRINTER_NAME # Send test print
|
|
194
|
+
|
|
195
|
+
# Template management
|
|
196
|
+
zday template list # List ZPL templates
|
|
197
|
+
zday template preview TEMPLATE # Generate PNG preview
|
|
198
|
+
zday template edit TEMPLATE # Open in editor
|
|
199
|
+
zday template show TEMPLATE # Display template contents
|
|
200
|
+
|
|
201
|
+
# Cognito authentication (requires pip install -e ".[auth]")
|
|
202
|
+
zday cognito status # Show auth configuration
|
|
203
|
+
zday cognito info # Setup instructions
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
#### Migration from 0.5.x
|
|
207
|
+
|
|
208
|
+
The old commands `zday_start` and `zday_quickstart` still work but are deprecated:
|
|
209
|
+
|
|
210
|
+
| Old Command | New Command |
|
|
211
|
+
|-------------|-------------|
|
|
212
|
+
| `zday_quickstart` | `zday bootstrap && zday gui start` |
|
|
213
|
+
| `zday_start` | `zday gui start` |
|
|
214
|
+
| `zday_start --auth cognito` | `zday gui start --auth cognito` |
|
|
215
|
+
|
|
216
|
+
### It Is 3+ Things
|
|
217
|
+
|
|
218
|
+
(1) Zebra Printer Management & Configuration
|
|
219
|
+
|
|
220
|
+
(2) ZPL Label Template Tools
|
|
221
|
+
|
|
222
|
+
(3) A Python Library To Manage Formulating & Sending Label Print Requests
|
|
223
|
+
|
|
224
|
+
(bonuses)
|
|
225
|
+
* a web gui to make some of the above more approachable && expose (3) as a http API.
|
|
226
|
+
* Documentation sufficent for organization to successfuly assemble & deploy a reasonalbly sized barcoding system in your operational environment in potentially weeks.
|
|
227
|
+
* ... and cheaply! a 10 printer install could cost ~$5,000.00 in purchases. With ongoing operational expenses of ~$150/mo (depends on label stock consumption mostly).
|
|
228
|
+
|
|
229
|
+
### And It Is Not
|
|
230
|
+
|
|
231
|
+
* _An Identify Generating Authority_
|
|
232
|
+
* you will need to produce your own UID/GUID/etc. This can be manual, spreadsheets, custom code, various RDBMS, LIMS systems, Salesforce... but should not be tangled in this package.
|
|
233
|
+
* also, METADATA regaring your UID is important as these metadata can be presented on the labels in addition to the human readable and scannable representation of the provided UID. [Unique Identifier Maxims](zebra_day/docs/uid_screed_light.md).
|
|
234
|
+
|
|
235
|
+
</ul>
|
|
236
|
+
|
|
237
|
+
## Getting Started
|
|
238
|
+
|
|
239
|
+
<ul>
|
|
240
|
+
|
|
241
|
+
### Facilitated :: Daylily Orchestrated Build and Deploy ( deliverable in ~1month )
|
|
242
|
+
* [Daylily is available to lead or contribute to the building and deployment of universal barcoding systems to your organizations operations](https://www.linkedin.com/in/john--major/). Daylily offers expertise with the entire process from evaluating existing operations systems, proposing integration options, securing all hardware, deploying hardware and software, and importantly: connecting newly deployed barcoding services to other LIS systems.
|
|
243
|
+
|
|
244
|
+
#### Universal Barcoding Capability Project Timing Estimates
|
|
245
|
+
|
|
246
|
+
<ul>
|
|
247
|
+
<ul>
|
|
248
|
+
|
|
249
|
+
> <img src=zebra_day/imgs/UBC_gantt_chart.png height=200 width=450>
|
|
250
|
+
|
|
251
|
+
</ul>
|
|
252
|
+
</ul>
|
|
253
|
+
|
|
254
|
+
### Requirements
|
|
255
|
+
* Tested and runs on MAC and Ubuntu (but other flavors of Linux should be no problem). Windows would be a rather large hassle, though presumably possible.
|
|
256
|
+
* [conda](https://conda.io/projects/conda/en/latest/user-guide/install/index.html#regular-installation) and [mamba](https://anaconda.org/conda-forge/mamba) installed. This is not, in fact, a blocking requirement, but other env setups have not been tested yet. __for MAC users, it may be advisable to install conda with homebrew__.
|
|
257
|
+
* create conda environment `ZDAY`, which will be used to run the UI
|
|
258
|
+
```bash
|
|
259
|
+
mamba create -n ZDAY -c conda-forge python==3.10 pip ipython
|
|
260
|
+
```
|
|
261
|
+
#### Nice To Have
|
|
262
|
+
* For MAC address discovery, `arp` should be installed (both for MAC and Linux).
|
|
263
|
+
##### Ubuntu
|
|
264
|
+
```bash
|
|
265
|
+
sudo apt-get install net-tools
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
##### MAC
|
|
269
|
+
* Should be pre-installed by default.
|
|
270
|
+
|
|
271
|
+
### Install From PIP
|
|
272
|
+
you can pip install `zebra_day` to any python environment running 3.10.*. If you plan to run the web UI or use the HTTP API functionality, run this in the above described `ZDAY` conda env. To install with pip:
|
|
273
|
+
|
|
274
|
+
```bash
|
|
275
|
+
pip install zebra_day
|
|
276
|
+
```
|
|
277
|
+
* reload your environment/shell.
|
|
278
|
+
|
|
279
|
+
|
|
280
|
+
### Install From Source
|
|
281
|
+
|
|
282
|
+
#### Clone Repository & Local PIP
|
|
283
|
+
|
|
284
|
+
* [From github via ssh](https://github.com/Daylily-Informatics/zebra_day)
|
|
285
|
+
|
|
286
|
+
```bash
|
|
287
|
+
git clone git@github.com:Daylily-Informatics/zebra_day.git
|
|
288
|
+
cd zebra_day
|
|
289
|
+
conda activate ZDAY # ZDAY was built with mamba earlier
|
|
290
|
+
|
|
291
|
+
# Modern install (recommended)
|
|
292
|
+
pip install -e . # Install in editable mode
|
|
293
|
+
pip install -e ".[dev]" # Include dev dependencies
|
|
294
|
+
pip install -e ".[lint]" # Include linting tools
|
|
295
|
+
pip install -e ".[all]" # Include all extras
|
|
296
|
+
|
|
297
|
+
# Build wheel/sdist
|
|
298
|
+
pip install build
|
|
299
|
+
python -m build # Creates dist/*.whl and dist/*.tar.gz
|
|
300
|
+
```
|
|
301
|
+
|
|
302
|
+
* `zebra_day` is now installed in your current python environment.
|
|
303
|
+
* reload your environment/shell.
|
|
304
|
+
|
|
305
|
+
### File Locations (XDG-compliant)
|
|
306
|
+
|
|
307
|
+
zebra_day 0.6.0+ uses XDG Base Directory specification for file storage:
|
|
308
|
+
|
|
309
|
+
| Type | macOS | Linux |
|
|
310
|
+
|------|-------|-------|
|
|
311
|
+
| **Config** | `~/Library/Preferences/zebra_day/` | `~/.config/zebra_day/` |
|
|
312
|
+
| **Data** | `~/Library/Application Support/zebra_day/` | `~/.local/share/zebra_day/` |
|
|
313
|
+
| **Logs** | `~/Library/Logs/zebra_day/` | `~/.local/state/zebra_day/` |
|
|
314
|
+
| **Cache** | `~/Library/Caches/zebra_day/` | `~/.cache/zebra_day/` |
|
|
315
|
+
|
|
316
|
+
Key files:
|
|
317
|
+
- `printer_config.json` - Printer fleet configuration (in config dir)
|
|
318
|
+
- `label_styles/` - ZPL template files (in data dir)
|
|
319
|
+
- `label_styles/tmps/` - Draft templates (in data dir)
|
|
320
|
+
|
|
321
|
+
Use `zday info` to see the exact paths on your system.
|
|
322
|
+
|
|
323
|
+
<br><br><br>
|
|
324
|
+
|
|
325
|
+
</ul>
|
|
326
|
+
|
|
327
|
+
|
|
328
|
+
## Hardware Config
|
|
329
|
+
### Quick
|
|
330
|
+
* Connect all zebra printers to the same network as the machine you'll be running `zebra_day` is connected to. Load labels, power on printers , confirm status lights are green, etc.
|
|
331
|
+
|
|
332
|
+
### [Hardware Guide](zebra_day/docs/hardware_config_guide.md)
|
|
333
|
+
* Info on hardware and consumables known to work with `zebra_day`. User guides, notes, part#s and costs for:
|
|
334
|
+
* Printers
|
|
335
|
+
* Label Stock
|
|
336
|
+
* Barcode Scanners
|
|
337
|
+
|
|
338
|
+
|
|
339
|
+
<br><br>
|
|
340
|
+
|
|
341
|
+
</ul>
|
|
342
|
+
|
|
343
|
+
<img src=zebra_day/imgs/bar_purp3.png>
|
|
344
|
+
|
|
345
|
+
# USAGE
|
|
346
|
+
|
|
347
|
+
<ul>
|
|
348
|
+
|
|
349
|
+
## QUICKSTART
|
|
350
|
+
* zebra printers -> power on and connect via cable or wifi to the same network the machine you installed `zebra_day` is on.
|
|
351
|
+
* activate the environment you have `zebra_day` installed into.
|
|
352
|
+
* If you have just pip installed `zebra_day` in the shell you are in, start a new shell.
|
|
353
|
+
|
|
354
|
+
```bash
|
|
355
|
+
# First-time setup: scan network for printers and initialize configuration
|
|
356
|
+
zday bootstrap
|
|
357
|
+
|
|
358
|
+
# Start the web UI (runs in background by default)
|
|
359
|
+
zday gui start
|
|
360
|
+
|
|
361
|
+
# Or start in foreground for debugging
|
|
362
|
+
zday gui start --foreground
|
|
363
|
+
```
|
|
364
|
+
|
|
365
|
+
### Example Output From `zday bootstrap`
|
|
366
|
+
<pre>
|
|
367
|
+
$ zday bootstrap
|
|
368
|
+
|
|
369
|
+
Detecting local IP address...
|
|
370
|
+
IP detected: 192.168.1.12 ... using IP root: 192.168.1
|
|
371
|
+
|
|
372
|
+
Scanning for Zebra printers on network (this may take a few minutes)...
|
|
373
|
+
|
|
374
|
+
Zebra Printer Scan Complete.
|
|
375
|
+
Found 2 printers:
|
|
376
|
+
- 192.168.1.7 (ZTC GX420d)
|
|
377
|
+
- 192.168.1.20 (ZD620)
|
|
378
|
+
|
|
379
|
+
Configuration saved to: ~/.config/zebra_day/printer_config.json
|
|
380
|
+
|
|
381
|
+
Run 'zday gui start' to launch the web interface.
|
|
382
|
+
</pre>
|
|
383
|
+
|
|
384
|
+
### Example Output From `zday gui start`
|
|
385
|
+
<pre>
|
|
386
|
+
$ zday gui start
|
|
387
|
+
|
|
388
|
+
Starting zebra_day web server...
|
|
389
|
+
Server running at: http://192.168.1.12:8118
|
|
390
|
+
|
|
391
|
+
Modern UI: http://192.168.1.12:8118/
|
|
392
|
+
Legacy UI: http://192.168.1.12:8118/legacy
|
|
393
|
+
API Docs: http://192.168.1.12:8118/docs
|
|
394
|
+
|
|
395
|
+
Server started in background (PID: 12345)
|
|
396
|
+
Use 'zday gui status' to check status
|
|
397
|
+
Use 'zday gui stop' to stop the server
|
|
398
|
+
</pre>
|
|
399
|
+
|
|
400
|
+
> The web service runs in the background. Use `zday gui status` to check if it's running, and `zday gui stop` to stop it.
|
|
401
|
+
|
|
402
|
+
#### zebra_day Web GUI
|
|
403
|
+
|
|
404
|
+
##### Home Page
|
|
405
|
+
<img src=zebra_day/imgs/zday_quick_gui.png>
|
|
406
|
+
|
|
407
|
+
##### Zebra Fleet Auto Discovery & Status Report
|
|
408
|
+
|
|
409
|
+
<img width="1024" alt="fleetreport" src="https://github.com/Daylily-Informatics/zebra_day/assets/4713659/8a66bc11-f8f5-4c40-9970-36d554a4593a">
|
|
410
|
+
|
|
411
|
+
|
|
412
|
+
##### Zebra Printer Fleet Config Json Editing
|
|
413
|
+
<img width="472" alt="pconfjson" src="https://github.com/Daylily-Informatics/zebra_day/assets/4713659/0813cb07-4c5a-4cc9-9b33-d00e8424385e">
|
|
414
|
+
One printer configured.
|
|
415
|
+
|
|
416
|
+
|
|
417
|
+
##### ZPL Template Drafting / Preview PNG / Test Print / Save
|
|
418
|
+
<img width="953" alt="zpl_editing" src="https://github.com/Daylily-Informatics/zebra_day/assets/4713659/15aac332-c5f8-4ce6-be6c-9c403fd8d35d">
|
|
419
|
+
|
|
420
|
+
|
|
421
|
+
##### Manual Print Requests
|
|
422
|
+
<img width="895" alt="printmanual" src="https://github.com/Daylily-Informatics/zebra_day/assets/4713659/72442f68-984f-4264-93ec-9878372d26f2">
|
|
423
|
+
|
|
424
|
+
|
|
425
|
+
<br><br>
|
|
426
|
+
|
|
427
|
+
|
|
428
|
+
## Programatic
|
|
429
|
+
### Quick
|
|
430
|
+
Open an ipython shell.
|
|
431
|
+
|
|
432
|
+
```python
|
|
433
|
+
import zebra_day.print_mgr as zdpm
|
|
434
|
+
|
|
435
|
+
zlab = zdpm.zpl()
|
|
436
|
+
|
|
437
|
+
zlab.probe_zebra_printers_add_to_printers_json('192.168.1') # REPLACE the IP stub with the correct value for your network. This may take a few min to run. !! This command is not required if you've sucessuflly run the quickstart already, also, won't hurt.
|
|
438
|
+
|
|
439
|
+
print(zlab.printers) # This should print out the json dict of all detected zebra printers. An empty dict, {}, is a failure of autodetection, and manual creation of the json file may be needed. If successful, the lab name assigned is 'scan-results', this may be edited latter.
|
|
440
|
+
|
|
441
|
+
# The json will loook something like this
|
|
442
|
+
## {'labs': {'scan-results': {'192.168.1.7': {'ip_address': '192.168.1.7', 'label_zpl_styles': ['test_2inX1in'], 'print_method': 'unk'}}}
|
|
443
|
+
## 'lab' name 'printer' name(can be edited latter) label_zpl_style
|
|
444
|
+
|
|
445
|
+
# Assuming a printer was detected, send a test print request. Using the 'lab', 'printer' and 'label_zpl_style' above (you'd have your own IP/Name, other values should remain the same for now. There are multiple label ZPL formats available, the test_2inX1in is for quick testing & only formats in the two UID values specified.
|
|
446
|
+
|
|
447
|
+
zlab.print_zpl(lab='scan-results', printer_name='192.168.1.7', label_zpl_style='test_2inX1in', uid_barcode="123aUID")
|
|
448
|
+
# ZPL code sent successfully to the printer!
|
|
449
|
+
# Out[13]: '^XA\n^FO235,20\n^BY1\n^B3N,N,40,N,N\n^FD123aUID^FS\n^FO235,70\n^ADN,30,20\n^FD123aUID^FS\n^FO235,115\n^ADN,25,12\n^FDalt_a^FS\n^FO235,145\n^ADN,25,12\n^FDalt_b^FS\n^FO70,180\n^FO235,170\n^ADN,30,20\n^FDalt_c^FS\n^FO490,180\n^ADN,25,12\n^FDalt_d^FS\n^XZ'
|
|
450
|
+
```
|
|
451
|
+
|
|
452
|
+
* This will produce a label which looks like this (modulo printer config items needing attention).
|
|
453
|
+

|
|
454
|
+
|
|
455
|
+
|
|
456
|
+
### [Programatic Guide](zebra_day/docs/programatic_guide.md)
|
|
457
|
+
|
|
458
|
+
|
|
459
|
+
<br><br>
|
|
460
|
+
|
|
461
|
+
## Print Request HTTP API
|
|
462
|
+
|
|
463
|
+
### Quick Start
|
|
464
|
+
|
|
465
|
+
The HTTP API is available via the web UI, and can be used programatically as well. The following is a quick example of how to send a print request via the HTTP API.
|
|
466
|
+
|
|
467
|
+
```bash
|
|
468
|
+
curl "http://localhost:8118/_print_label?lab=MA&printer=192.168.1.31&printer_ip=&label_zpl_style=tube_2inX1in&uid_barcode=BARCODE&alt_a=FIELDAAAA&alt_b=FIELDBBBB&alt_c=FIELDCCCC&alt_d=FIELDDDD&alt_e=FIELDEEEE&alt_f=FIELDFFFF"
|
|
469
|
+
|
|
470
|
+
# RETURNS 200 OK -or- 500 Internal Server Error (usually b/c the target printer is not reachable)
|
|
471
|
+
|
|
472
|
+
```
|
|
473
|
+
> The above would send a print request to the specified printer, identified by it's network IP. Label style can be set, and some styles use more `alt_*` fields than others. This reuest will return `200` or `500`.
|
|
474
|
+
|
|
475
|
+
## Web UI
|
|
476
|
+
|
|
477
|
+
### Quick Start
|
|
478
|
+
|
|
479
|
+
```bash
|
|
480
|
+
# Start the web server (runs in background)
|
|
481
|
+
zday gui start
|
|
482
|
+
|
|
483
|
+
# Check status
|
|
484
|
+
zday gui status
|
|
485
|
+
|
|
486
|
+
# View logs
|
|
487
|
+
zday gui logs --tail 50
|
|
488
|
+
|
|
489
|
+
# Stop the server
|
|
490
|
+
zday gui stop
|
|
491
|
+
|
|
492
|
+
# Or run in foreground for debugging
|
|
493
|
+
zday gui start --foreground
|
|
494
|
+
|
|
495
|
+
# Or run via uvicorn directly (more control over options)
|
|
496
|
+
uvicorn zebra_day.web.app:create_app --host 0.0.0.0 --port 8118 --factory
|
|
497
|
+
```
|
|
498
|
+
|
|
499
|
+
### Modern vs Legacy UI
|
|
500
|
+
|
|
501
|
+
zebra_day 0.6.0+ includes a redesigned modern UI alongside the preserved legacy interface:
|
|
502
|
+
|
|
503
|
+
| Interface | URL | Description |
|
|
504
|
+
|-----------|-----|-------------|
|
|
505
|
+
| **Modern UI** | `http://localhost:8118/` | New dashboard with stats, quick actions, improved navigation |
|
|
506
|
+
| **Legacy UI** | `http://localhost:8118/legacy` | Original interface, fully functional |
|
|
507
|
+
| **API Docs** | `http://localhost:8118/docs` | Interactive OpenAPI/Swagger documentation |
|
|
508
|
+
| **ReDoc** | `http://localhost:8118/redoc` | Alternative API documentation |
|
|
509
|
+
|
|
510
|
+
Both interfaces provide full functionality. The modern UI offers:
|
|
511
|
+
- Dashboard with printer fleet statistics
|
|
512
|
+
- Streamlined navigation
|
|
513
|
+
- Improved template editor
|
|
514
|
+
- Better mobile responsiveness
|
|
515
|
+
|
|
516
|
+
### Print via HTTP API
|
|
517
|
+
|
|
518
|
+
```http
|
|
519
|
+
http://YOUR.HOST.IP.ADDR:8118/_print_label?lab=scan-results&printer=192.168.1.7&label_zpl_style=test_2inX1in&uid_barcode=123aUID
|
|
520
|
+
```
|
|
521
|
+
|
|
522
|
+
* See the [Web UI Guide](zebra_day/docs/zebra_day_ui_guide.md) for full details.
|
|
523
|
+
|
|
524
|
+
### [Web UI Guide](zebra_day/docs/zebra_day_ui_guide.md)
|
|
525
|
+
|
|
526
|
+
|
|
527
|
+
<br><br>
|
|
528
|
+
|
|
529
|
+
</ul>
|
|
530
|
+
<img src=zebra_day/imgs/bar_red.png>
|
|
531
|
+
|
|
532
|
+
# Other Topics
|
|
533
|
+
|
|
534
|
+
## Security
|
|
535
|
+
|
|
536
|
+
### Authentication
|
|
537
|
+
|
|
538
|
+
zebra_day supports optional AWS Cognito authentication for production deployments.
|
|
539
|
+
|
|
540
|
+
#### Enabling Cognito Authentication
|
|
541
|
+
|
|
542
|
+
1. **Install auth dependencies**:
|
|
543
|
+
```bash
|
|
544
|
+
pip install -e ".[auth]"
|
|
545
|
+
```
|
|
546
|
+
|
|
547
|
+
2. **Set required environment variables**:
|
|
548
|
+
```bash
|
|
549
|
+
export COGNITO_USER_POOL_ID="us-west-2_XXXXXXXXX"
|
|
550
|
+
export COGNITO_APP_CLIENT_ID="your-app-client-id"
|
|
551
|
+
export COGNITO_REGION="us-west-2" # Optional, defaults to us-west-2
|
|
552
|
+
export AWS_PROFILE="your-profile" # Optional, for local development
|
|
553
|
+
```
|
|
554
|
+
|
|
555
|
+
3. **Start server with authentication**:
|
|
556
|
+
```bash
|
|
557
|
+
zday gui start --auth cognito
|
|
558
|
+
|
|
559
|
+
# Check auth status
|
|
560
|
+
zday cognito status
|
|
561
|
+
```
|
|
562
|
+
|
|
563
|
+
#### Authentication Modes
|
|
564
|
+
|
|
565
|
+
| Mode | CLI Flag | Description |
|
|
566
|
+
|------|----------|-------------|
|
|
567
|
+
| None (default) | `--auth none` | No authentication required. All endpoints are publicly accessible. |
|
|
568
|
+
| Cognito | `--auth cognito` | AWS Cognito JWT authentication. All endpoints except health checks require a valid Bearer token. |
|
|
569
|
+
|
|
570
|
+
#### Protected Endpoints
|
|
571
|
+
|
|
572
|
+
When `--auth cognito` is enabled:
|
|
573
|
+
- All UI and API endpoints require a valid JWT Bearer token
|
|
574
|
+
- Health endpoints (`/healthz`, `/readyz`) remain publicly accessible
|
|
575
|
+
- Static files (`/static/*`, `/files/*`, `/etc/*`) remain publicly accessible
|
|
576
|
+
- API documentation (`/docs`, `/redoc`, `/openapi.json`) remains accessible
|
|
577
|
+
|
|
578
|
+
#### Making Authenticated Requests
|
|
579
|
+
|
|
580
|
+
Include the JWT token in the Authorization header:
|
|
581
|
+
```bash
|
|
582
|
+
curl -H "Authorization: Bearer YOUR_JWT_TOKEN" http://localhost:8118/api/v1/printers
|
|
583
|
+
```
|
|
584
|
+
|
|
585
|
+
### Secrets
|
|
586
|
+
No credentials of any kind are stored or used by `zebra_day`. It solely offers zebra printer management and label print request formatting and brokering services. It does not need to know how to connect to other systems, other systems will use the library code provided here, or the http api.
|
|
587
|
+
|
|
588
|
+
### Host and Network Security
|
|
589
|
+
In it's present state, `zebra_day` is safe to run on a machine located in a properly configured & secure local network or cloud hosted instance residing in a secure VPN/VPC.
|
|
590
|
+
* `zebra_day` should not be deployed in such a way the host is fully visible to the public internet.
|
|
591
|
+
* a potential exception would be exposing the service via an encryped and secure open port. __POC demonstrating this concept can be found below__.
|
|
592
|
+
|
|
593
|
+
### Programatic Use Of `zebra_day` Package/Library
|
|
594
|
+
Using the python library in other python code poses no particularly unique new risk. `zebra_day` may be treated similarly to how other third party tools are handled in each users organization.
|
|
595
|
+
|
|
596
|
+
## Regulatory & Compliance
|
|
597
|
+
### HIPAA / CAP / CLIA
|
|
598
|
+
No PHI is needed by `zebra_day` to function. PHI may be sent in print rquests, each organization will have their own use cases. `zebra_day` does not store any of the print request metadata sent to it, the info is redirected to the appropriate zebra printer, and that is that. It is straightforward when setting up the host machine/environment this package will be running in to check off the various HIPAA and CAP/CLIA expectations where they apply.
|
|
599
|
+
|
|
600
|
+
|
|
601
|
+
|
|
602
|
+
|
|
603
|
+
|
|
604
|
+
# A Few Integration Demonstrations
|
|
605
|
+
|
|
606
|
+
# Send Label Print Requests From Public Internet To Host PC w/In Your Private Network
|
|
607
|
+
|
|
608
|
+
## Ditch The Private Local Network & Expose Server Publicly ( not advised )
|
|
609
|
+
really
|
|
610
|
+
|
|
611
|
+
## Using NGROK To Present A Tunneled Port Connected To The `zebra_day` Host Port (up and running in <5 min!)
|
|
612
|
+
|
|
613
|
+
* Create a tunnel to connect to the zebra_day service running on a machine within your network on port 8118. This could be a cloud instance w/in a VPC you control, or a machine physically present w/in your network.
|
|
614
|
+
|
|
615
|
+
* [NGROK DOCS]( https://dashboard.ngrok.com/get-started/setup/macos)
|
|
616
|
+
|
|
617
|
+
### Install ngrok
|
|
618
|
+
|
|
619
|
+
```bash
|
|
620
|
+
brew install ngrok/ngrok/ngrok
|
|
621
|
+
ngrok config add-authtoken MYTOKEN # you get this once registered (its free!)
|
|
622
|
+
```
|
|
623
|
+
|
|
624
|
+
### Running ngrok
|
|
625
|
+
```bash
|
|
626
|
+
ngrok http 8118
|
|
627
|
+
```
|
|
628
|
+
|
|
629
|
+
Which starts a tunnel and presents a monitoring dashboard. And it looks like this:
|
|
630
|
+
<pre>
|
|
631
|
+
ngrok (Ctrl+C to quit)
|
|
632
|
+
|
|
633
|
+
Introducing Always-On Global Server Load Balancer: https://ngrok.com/r/gslb
|
|
634
|
+
|
|
635
|
+
Session Status online
|
|
636
|
+
Account USERNAME (Plan: Free)
|
|
637
|
+
Version 3.3.5
|
|
638
|
+
Region United States (California) (us-cal-1)
|
|
639
|
+
Latency 12ms
|
|
640
|
+
Web Interface http://127.0.0.1:4040
|
|
641
|
+
Forwarding https://dfbf-23-93-175-197.ngrok-free.app -> http://localhost:8118
|
|
642
|
+
|
|
643
|
+
Connections ttl opn rt1 rt5 p50 p90
|
|
644
|
+
8 0 0.00 0.01 10.03 28.05
|
|
645
|
+
|
|
646
|
+
HTTP Requests
|
|
647
|
+
-------------
|
|
648
|
+
|
|
649
|
+
GET /_print_label 200 OK
|
|
650
|
+
GET /_print_label 200 OK
|
|
651
|
+
GET /build_print_request 200 OK
|
|
652
|
+
GET /send_print_request 200 OK
|
|
653
|
+
GET / 200 OK
|
|
654
|
+
GET /_print_label 200 OK
|
|
655
|
+
GET /_print_label 200 OK
|
|
656
|
+
GET /build_print_request 200 OK
|
|
657
|
+
GET /send_print_request 200 OK
|
|
658
|
+
GET /favicon.ico 200 OK ~
|
|
659
|
+
</pre>
|
|
660
|
+
|
|
661
|
+
And looks like:
|
|
662
|
+
<img src=zebra_day/imgs/ngrok.png>
|
|
663
|
+
|
|
664
|
+
* If you leave the ngrok tunnel running, go to a different network, you can use the link named in the `Forwarding` row above to access the zebra_day UI, in the above example, this url would be `https://dfbf-23-93-175-197.ngrok-free.app`.
|
|
665
|
+
|
|
666
|
+
#### Sending Label Print Requests
|
|
667
|
+
##### from a web browser on a different network
|
|
668
|
+
|
|
669
|
+
`https://dfbf-23-93-175-197.ngrok-free.app/_print_label?uid_barcode=UID33344455&alt_a=altTEXTAA&alt_b=altTEXTBB&alt_c=altTEXTCC&alt_d=&alt_e=&alt_f=&lab=scan-results&printer=192.168.1.20&printer_ip=192.168.1.20&label_zpl_style=tube_2inX1in`
|
|
670
|
+
|
|
671
|
+
##### Using wget from a shell on a machine outside your local network
|
|
672
|
+
```bash
|
|
673
|
+
wget "https://dfbf-23-93-175-197.ngrok-free.app/_print_label?uid_barcode=UID33344455&alt_a=altTEXTAA&alt_b=altTEXTBB&alt_c=altTEXTCC&alt_d=&alt_e=&alt_f=&lab=scan-results&printer=192.168.1.20&printer_ip=192.168.1.20&label_zpl_style=tube_2inX1in"
|
|
674
|
+
```
|
|
675
|
+
|
|
676
|
+
### From SalesForce
|
|
677
|
+
|
|
678
|
+
* There are several ways to do this, but they all boil down to somehow formulating a URL for each print request, ie: `https://dfbf-23-93-175-197.ngrok-free.app/_print_label?uid_barcode=UID33344455&lab=scan-results&printer=192.168.1.20&label_zpl_style=tube_2inX1in`, and hitting the URL via Apex, Flow, etc.
|
|
679
|
+
* To send a print request, you will need to know the API url, and the `lab`, `printer_name`, and `label_zpl_style` you wish to print the salesforce `Name` aka `UID` as a label. This example explains how to pass just one variable to print from salesforce, adding additional metadata to print involves adding additional params to the url being constructed.
|
|
680
|
+
|
|
681
|
+
|
|
682
|
+
#### Print Upon Object Creation (Apex Class + Flow)
|
|
683
|
+
|
|
684
|
+
> The following is a very quick prof of concept to see it work(success!). I fully expect there are more robust ways to reach this goal.
|
|
685
|
+
|
|
686
|
+
Create an Apex class to handle sending HTTP requests.
|
|
687
|
+
|
|
688
|
+
* Setup->Apex Classes, create new Apex Class, save the following as the Apex Class:
|
|
689
|
+
|
|
690
|
+
```java
|
|
691
|
+
public class HttpRequestFlowAction {
|
|
692
|
+
|
|
693
|
+
public class RequestInput {
|
|
694
|
+
@InvocableVariable(label='Endpoint URL' required=true)
|
|
695
|
+
public String url;
|
|
696
|
+
|
|
697
|
+
// Add other variables as needed, e.g. headers, body, method, etc.
|
|
698
|
+
}
|
|
699
|
+
|
|
700
|
+
@InvocableMethod(label='Make HTTP Request' description='Makes an HTTP request from a Flow.')
|
|
701
|
+
public static List<String> makeHttpRequest(List<RequestInput> requests) {
|
|
702
|
+
List<String> responses = new List<String>();
|
|
703
|
+
|
|
704
|
+
for(RequestInput req : requests) {
|
|
705
|
+
Http http = new Http();
|
|
706
|
+
HttpRequest request = new HttpRequest();
|
|
707
|
+
request.setEndpoint(req.url);
|
|
708
|
+
request.setMethod('GET'); // Change method as needed: POST, PUT, etc.
|
|
709
|
+
|
|
710
|
+
// Add headers, body, etc. if needed.
|
|
711
|
+
|
|
712
|
+
HttpResponse response = http.send(request);
|
|
713
|
+
responses.add(response.getBody());
|
|
714
|
+
}
|
|
715
|
+
|
|
716
|
+
return responses;
|
|
717
|
+
}
|
|
718
|
+
}
|
|
719
|
+
```
|
|
720
|
+
|
|
721
|
+
* click save, the apex class is now ready. Check the security settings and verify the profile associated with your user has access to see/use this class.
|
|
722
|
+
|
|
723
|
+
Next, create a flow which uses this Apex Class.
|
|
724
|
+
|
|
725
|
+
* setup->Flow & click `New Flow`. I remained in the `Auto Layout` view.
|
|
726
|
+
* Choose `Record-Triggered Flow`
|
|
727
|
+
* Select the object type the flow will be triggered when an instance of this object type is created.
|
|
728
|
+
* Select 'A record is created` as the trigger.
|
|
729
|
+
* Set Entry Conditions (this might be unecessary), `Any Condition Is Met`, Field `Name`, Operator `Starts with`, Value `X`(X being the first letter of the Name field UID salesforce creates for this object. Again, this is probably not needed, but I have not gone back to try w/out this step).
|
|
730
|
+
* Choose `Actions and Related Records`, and check the box at the bottom of the page to `Include a Run Asynchronously path...`
|
|
731
|
+
* upon clicking this box, the graphic representation of the flow to the left of the page will now have 2 branches at the bottom of the flow rule, one `Run Immediately` and one `Run Asynchronously`. The `Run Immediately` branch was throwing errors, so I removed it to debug at a latter date.
|
|
732
|
+
* Click the node just below the `Run Asynch` oval. Add an `Action`. Select the `Make HTTP Request` we created via the Apex Class above. Give it a `Label`, let the API Name auto generate.
|
|
733
|
+
* In the `Endpoint URL` field, enter the url `https://dfbf-23-93-175-197.ngrok-free.app/_print_label?uid_barcode={!$Record.Name}&lab=scan-results&printer=!!YOURPRINTERIP!!&label_zpl_style=tube_2inX1in`, where Record.Name will be replaced with the Object.Name from the object triggering the flow. Replace !!YOURPRINTERIP!! with one of the printer IPs zebra_day detected above. If you are using the auto-generated zebra printers config json file, you may leave `scan-results` as the value for `lab=` as this will be the default name given when zebra_day autodetects printers.
|
|
734
|
+
* add the same HTTPrequest action to the node just below `Run Immediately`.
|
|
735
|
+
* click `Save` in the upper right corner of the page. Give it a name
|
|
736
|
+
* Click `Debug Again`, run the `Run Immediately` branch first. This will fail.
|
|
737
|
+
* You need to whitelist the URL used by Apex in this flow with Salesforce. To do this: Setup->Remote Site Settings, click `New Remote Site`. Give it a name, and enter your ngrok URL up to the `.app`, so: `https://dfbf-23-93-175-197.ngrok-free.app`. Click the `active` checkbox and then save.
|
|
738
|
+
* CLick `Debug Again`, run the `Asyncronous` branch, this should succeed.
|
|
739
|
+
* Click `Save As`, new version.
|
|
740
|
+
* Click `Activate`
|
|
741
|
+
* Go create one of the objects you made this flow for. This will fail!
|
|
742
|
+
* Go back to your flow, click `edit flow`, switch from `Auto Layout` to `Freeform` view.
|
|
743
|
+
* Click the connector labeled `Run Immediately`, delete it (leave the Async branch intact)
|
|
744
|
+
* Click `Save As`, new version.
|
|
745
|
+
* Click `Activate`
|
|
746
|
+
* Go create a new object of the type this trigger is built to respond to... it should print, and should do so each time a new object is created.
|
|
747
|
+
* This toy example is intended to demonstrate this can work. Next, you should determine how you'd like to send print requests that best suits your needs.
|
|
748
|
+
|
|
749
|
+
> This was all rather a PITA honestly.
|
|
750
|
+
|
|
751
|
+
###### Create a Formula Text Field For Objects
|
|
752
|
+
You can construct the print URL in the formula, and this formula field can be presented on the object salesforce page. If the user clicks the URL on the page, a print request is sent containing the data inserted by the formula for the current object.
|
|
753
|
+
|
|
754
|
+
|
|
755
|
+
## Host Machine Options
|
|
756
|
+
### Machine physically connected to your local network.
|
|
757
|
+
This is covered in the config and setup/install instructions above.
|
|
758
|
+
|
|
759
|
+
### AWS
|
|
760
|
+
#### ec2 instance
|
|
761
|
+
more info coming soon. The instructions for getting the package s/w up and running is largely the same as above. However, care must be taken when configuring the network and instances which will be used at amazon.
|
|
762
|
+
|
|
763
|
+
##### From AMI?
|
|
764
|
+
|
|
765
|
+
|
|
766
|
+
## Other Providers
|
|
767
|
+
If it will work on AWS, it will work anyplace really (with some provider specific tweaks).
|
|
768
|
+
|
|
769
|
+
## Docker
|
|
770
|
+
Find an example in the docker folder at the top level of this project. Copy the Dockerfile and the docker-compose.yml to a local folder on your computer.
|
|
771
|
+
In that folder, `mkdir etc && chmod 777 etc && mkdir logs && chmod 777 logs` to setup the example folders.
|
|
772
|
+
Tthen run `sudo docker compose up --build -d` to run it then reach it at http://<your-ip>:8118. This doesn't auto-detect printers so you'll have to run the printer discovery and probably manually edit your JSON file.
|
|
773
|
+
|
|
774
|
+
# Add'l Future Development
|
|
775
|
+
|
|
776
|
+
* Set varios printer config via ZPL commands (presently this package only fetches config).
|
|
777
|
+
|
|
778
|
+
|
|
779
|
+
# BadgeLand
|
|
780
|
+
|
|
781
|
+
[](https://github.com/Daylily-Informatics/zebra_day/actions/workflows/main.yaml)
|
|
782
|
+
|
|
783
|
+
<br>
|
|
784
|
+
|
|
785
|
+
|
|
786
|
+
|