aioipp 0.18.0__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.
@@ -0,0 +1,109 @@
1
+ Metadata-Version: 2.4
2
+ Name: aioipp
3
+ Version: 0.18.0
4
+ Summary: Asynchronous Python client for Internet Printing Protocol (IPP), a maintained fork of pyipp
5
+ License: MIT
6
+ License-File: LICENSE
7
+ Keywords: ipp,api,async,client,printer
8
+ Author: Chris Talkington
9
+ Author-email: chris@talkingtontech.com
10
+ Maintainer: Brian Egge
11
+ Maintainer-email: brianegge@gmail.com
12
+ Requires-Python: >=3.9,<4.0
13
+ Classifier: Development Status :: 4 - Beta
14
+ Classifier: Framework :: AsyncIO
15
+ Classifier: Intended Audience :: Developers
16
+ Classifier: License :: OSI Approved :: MIT License
17
+ Classifier: Natural Language :: English
18
+ Classifier: Programming Language :: Python :: 3
19
+ Classifier: Programming Language :: Python :: 3.9
20
+ Classifier: Programming Language :: Python :: 3.10
21
+ Classifier: Programming Language :: Python :: 3.11
22
+ Classifier: Programming Language :: Python :: 3.12
23
+ Classifier: Programming Language :: Python :: 3.13
24
+ Classifier: Programming Language :: Python :: 3.14
25
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
26
+ Requires-Dist: aiohttp (>=3.0.0)
27
+ Requires-Dist: async-timeout (==5.0.1) ; python_version < "3.11"
28
+ Requires-Dist: awesomeversion (>=21.10.1)
29
+ Requires-Dist: backoff (>=2.2.0)
30
+ Requires-Dist: deepmerge (>=1.1.0)
31
+ Requires-Dist: yarl (>=1.6.0)
32
+ Project-URL: Bug Tracker, https://github.com/brianegge/aioipp/issues
33
+ Project-URL: Changelog, https://github.com/brianegge/aioipp/releases
34
+ Project-URL: Documentation, https://github.com/brianegge/aioipp
35
+ Project-URL: Homepage, https://github.com/brianegge/aioipp
36
+ Project-URL: Repository, https://github.com/brianegge/aioipp
37
+ Description-Content-Type: text/markdown
38
+
39
+ # Python: Internet Printing Protocol (IPP) Client
40
+
41
+ Asynchronous Python client for Internet Printing Protocol (IPP).
42
+
43
+ > **Note:** `aioipp` is a maintained fork of [pyipp](https://github.com/ctalkington/python-ipp)
44
+ > by Chris Talkington. It keeps the `pyipp` import name and adds page counter support.
45
+ > It is published on PyPI as `aioipp`; do not install it alongside `pyipp`.
46
+
47
+ ## About
48
+
49
+ This package allows you to monitor printers that support the Internet Printing Protocol (IPP) programmatically.
50
+
51
+ ## Installation
52
+
53
+ ```bash
54
+ pip install aioipp
55
+ ```
56
+
57
+ ## Usage
58
+
59
+ ```python
60
+ import asyncio
61
+
62
+ from pyipp import IPP, Printer
63
+
64
+
65
+ async def main():
66
+ """Show example of connecting to your IPP print server."""
67
+ async with IPP("ipps://EPSON123456.local:631/ipp/print") as ipp:
68
+ printer: Printer = await ipp.printer()
69
+ print(printer)
70
+
71
+
72
+ if __name__ == "__main__":
73
+ loop = asyncio.get_event_loop()
74
+ loop.run_until_complete(main())
75
+ ```
76
+
77
+ ## Setting up development environment
78
+
79
+ This Python project is fully managed using the [Poetry](https://python-poetry.org) dependency
80
+ manager. But also relies on the use of NodeJS for certain checks during
81
+ development.
82
+
83
+ You need at least:
84
+
85
+ - Python 3.9+
86
+ - [Poetry](https://python-poetry.org/docs/#installation)
87
+ - NodeJS 20+ (including NPM)
88
+
89
+ To install all packages, including all development requirements:
90
+
91
+ ```bash
92
+ npm install
93
+ poetry install
94
+ ```
95
+
96
+ As this repository uses the [pre-commit](https://pre-commit.com/) framework, all changes
97
+ are linted and tested with each commit. You can run all checks and tests
98
+ manually, using the following command:
99
+
100
+ ```bash
101
+ poetry run pre-commit run --all-files
102
+ ```
103
+
104
+ To run just the Python tests:
105
+
106
+ ```bash
107
+ poetry run pytest
108
+ ```
109
+
@@ -0,0 +1,14 @@
1
+ pyipp/__init__.py,sha256=qoupNnNbtGqZqKwYCs8R1LDv2ID7PJDN6EiPCpEE9V8,595
2
+ pyipp/const.py,sha256=nVkbrG66WOCD8nCCl2mm99CgZuk_lIQnGFhILmyeQVs,1175
3
+ pyipp/enums.py,sha256=-Kw3oaCpS9W5Ei4KkTLYNnBigvsqM1Tfc7xbAkDZgOo,9683
4
+ pyipp/exceptions.py,sha256=yyv7xYqu2s7e_RRb_41jB7opbz-tYkQSam6EIzVAc8Q,486
5
+ pyipp/ipp.py,sha256=XIOZHCkMV354q9bvbRDW75ZHofNvdV6EsLIYZ0b9enU,7932
6
+ pyipp/models.py,sha256=07NjWOxgmSq9pnO79yRHkQsiJ8r4eT2cHB51JNvsIQE,12402
7
+ pyipp/parser.py,sha256=SN_4ZV0R9wMk-m_ObuaAyUmPtHfhG1SQyqTFwI0lz6A,12401
8
+ pyipp/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
9
+ pyipp/serializer.py,sha256=7zCLnkZwxLkYrkCDGT59GjDkfbt5PN4SxdwcZNUvEfE,3116
10
+ pyipp/tags.py,sha256=e8W_yt6l81FL97KV9vwKQFwemFnGHDPd_cm-inaSi0Q,2460
11
+ aioipp-0.18.0.dist-info/METADATA,sha256=gAQSXMjLH9L1haYzh0hafzpEW-DpA_qLUTDLJQtH44E,3322
12
+ aioipp-0.18.0.dist-info/WHEEL,sha256=EGEvSphFYqXKs23-kQBeyNoJP1nrT8ZJKQoi5p5DYL8,88
13
+ aioipp-0.18.0.dist-info/licenses/LICENSE,sha256=-X3be30tryUSbIFKN8sMrxJ5iTwCqiuKG7EESNBmhu8,1073
14
+ aioipp-0.18.0.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: poetry-core 2.4.0
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2020 Chris Talkington
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
pyipp/__init__.py ADDED
@@ -0,0 +1,34 @@
1
+ """Asynchronous Python client for IPP."""
2
+ from .exceptions import (
3
+ IPPConnectionError,
4
+ IPPConnectionUpgradeRequired,
5
+ IPPError,
6
+ IPPParseError,
7
+ IPPResponseError,
8
+ IPPVersionNotSupportedError,
9
+ )
10
+ from .ipp import IPP
11
+ from .models import (
12
+ Counters,
13
+ Info,
14
+ Marker,
15
+ Printer,
16
+ State,
17
+ Uri,
18
+ )
19
+
20
+ __all__ = [
21
+ "Counters",
22
+ "Info",
23
+ "Marker",
24
+ "Printer",
25
+ "State",
26
+ "Uri",
27
+ "IPP",
28
+ "IPPConnectionError",
29
+ "IPPConnectionUpgradeRequired",
30
+ "IPPError",
31
+ "IPPParseError",
32
+ "IPPResponseError",
33
+ "IPPVersionNotSupportedError",
34
+ ]
pyipp/const.py ADDED
@@ -0,0 +1,52 @@
1
+ """Constants for IPP."""
2
+
3
+ DEFAULT_CHARSET = "utf-8"
4
+ DEFAULT_CHARSET_LANGUAGE = "en-US"
5
+
6
+ DEFAULT_CLASS_ATTRIBUTES = ["printer-name", "member-names"]
7
+
8
+ DEFAULT_JOB_ATTRIBUTES = [
9
+ "job-id",
10
+ "job-name",
11
+ "printer-uri",
12
+ "job-state",
13
+ "job-state-reasons",
14
+ "job-hold-until",
15
+ "job-media-progress",
16
+ "job-k-octets",
17
+ "number-of-documents",
18
+ "copies",
19
+ "job-originating-user-name",
20
+ ]
21
+
22
+ DEFAULT_PRINTER_ATTRIBUTES = [
23
+ "printer-device-id",
24
+ "printer-name",
25
+ "printer-type",
26
+ "printer-location",
27
+ "printer-info",
28
+ "printer-make-and-model",
29
+ "printer-state",
30
+ "printer-state-message",
31
+ "printer-state-reasons",
32
+ "printer-supply",
33
+ "printer-up-time",
34
+ "printer-uri-supported",
35
+ "device-uri",
36
+ "printer-is-shared",
37
+ "printer-more-info",
38
+ "printer-firmware-string-version",
39
+ "marker-colors",
40
+ "marker-high-levels",
41
+ "marker-levels",
42
+ "marker-low-levels",
43
+ "marker-names",
44
+ "marker-types",
45
+ "printer-impressions-completed",
46
+ "printer-impressions-completed-col",
47
+ "printer-pages-completed",
48
+ "printer-media-sheets-completed",
49
+ ]
50
+
51
+ DEFAULT_PORT = 631
52
+ DEFAULT_PROTO_VERSION = (2, 0)
pyipp/enums.py ADDED
@@ -0,0 +1,334 @@
1
+ """Enumerators for IPP."""
2
+ from enum import IntEnum
3
+
4
+
5
+ class IppStatus(IntEnum):
6
+ """Represent the ENUMs of a status response."""
7
+
8
+ CUPS_INVALID = -1
9
+ OK = 0x0000
10
+ OK_IGNORED_OR_SUBSTITUTED = 0x0001
11
+ OK_CONFLICTING = 0x0002
12
+ OK_IGNORED_SUBSCRIPTIONS = 0x0003
13
+ OK_IGNORED_NOTIFICATIONS = 0x0004
14
+ OK_TOO_MANY_EVENTS = 0x0005
15
+ OK_BUT_CANCEL_SUBSCRIPTION = 0x0006
16
+ OK_EVENTS_COMPLETE = 0x0007
17
+ REDIRECTION_OTHER_SITE = 0x0200
18
+ CUPS_SEE_OTHER = 0x0280
19
+ ERROR_BAD_REQUEST = 0x0400
20
+ ERROR_FORBIDDEN = 0x0401
21
+ ERROR_NOT_AUTHENTICATED = 0x0402
22
+ ERROR_NOT_AUTHORIZED = 0x0403
23
+ ERROR_NOT_POSSIBLE = 0x0404
24
+ ERROR_TIMEOUT = 0x0405
25
+ ERROR_NOT_FOUND = 0x0406
26
+ ERROR_GONE = 0x0407
27
+ ERROR_REQUEST_ENTITY = 0x0408
28
+ ERROR_REQUEST_VALUE = 0x0409
29
+ ERROR_DOCUMENT_FORMAT_NOT_SUPPORTED = 0x040A
30
+ ERROR_ATTRIBUTES_OR_VALUES = 0x040B
31
+ ERROR_URI_SCHEME = 0x040C
32
+ ERROR_CHARSET = 0x040D
33
+ ERROR_CONFLICTING = 0x040E
34
+ ERROR_COMPRESSION_ERROR = 0x040F
35
+ ERROR_DOCUMENT_FORMAT_ERROR = 0x0410
36
+ ERROR_DOCUMENT_ACCESS = 0x0411
37
+ ERROR_ATTRIBUTES_NOT_SETTABLE = 0x0412
38
+ ERROR_IGNORED_ALL_SUBSCRIPTIONS = 0x0413
39
+ ERROR_TOO_MANY_SUBSCRIPTIONS = 0x0414
40
+ ERROR_IGNORED_ALL_NOTIFICATIONS = 0x0415
41
+ ERROR_PRINT_SUPPORT_FILE_NOT_FOUND = 0x0416
42
+ ERROR_DOCUMENT_PASSWORD = 0x0417
43
+ ERROR_DOCUMENT_PERMISSION = 0x0418
44
+ ERROR_DOCUMENT_SECURITY = 0x0419
45
+ ERROR_DOCUMENT_UNPRINTABLE = 0x041A
46
+ ERROR_ACCOUNT_INFO_NEEDED = 0x041B
47
+ ERROR_ACCOUNT_CLOSED = 0x041C
48
+ ERROR_ACCOUNT_LIMIT_REACHED = 0x041D
49
+ ERROR_ACCOUNT_AUTHORIZATION_FAILED = 0x041E
50
+ ERROR_NOT_FETCHABLE = 0x041F
51
+ ERROR_CUPS_ACCOUNT_INFO_NEEDED = 0x049C
52
+ ERROR_CUPS_ACCOUNT_CLOSED = 0x049D
53
+ ERROR_CUPS_ACCOUNT_LIMIT_REACHED = 0x049E
54
+ ERROR_CUPS_ACCOUNT_AUTHORIZATION_FAILED = 0x049F
55
+ ERROR_INTERNAL = 0x0500
56
+ ERROR_OPERATION_NOT_SUPPORTED = 0x0501
57
+ ERROR_SERVICE_UNAVAILABLE = 0x0502
58
+ ERROR_VERSION_NOT_SUPPORTED = 0x0503
59
+ ERROR_DEVICE = 0x0504
60
+ ERROR_TEMPORARY = 0x0505
61
+ ERROR_NOT_ACCEPTING_JOBS = 0x0506
62
+ ERROR_BUSY = 0x0507
63
+ ERROR_JOB_CANCELED = 0x0508
64
+ ERROR_MULTIPLE_JOBS_NOT_SUPPORTED = 0x0509
65
+ ERROR_PRINTER_IS_DEACTIVATED = 0x050A
66
+ ERROR_TOO_MANY_JOBS = 0x050B
67
+ ERROR_TOO_MANY_DOCUMENTS = 0x050C
68
+ ERROR_CUPS_AUTHENTICATION_CANCELED = 0x1000
69
+ ERROR_CUPS_PKI = 0x1001
70
+ ERROR_CUPS_UPGRADE_REQUIRED = 0x1002
71
+
72
+
73
+ class IppOperation(IntEnum):
74
+ """Represent the ENUMs of an operation."""
75
+
76
+ CUPS_INVALID = -0x0001
77
+ CUPS_NONE = 0x0000
78
+ PRINT_JOB = 0x0002
79
+ PRINT_URI = 0x0003
80
+ VALIDATE_JOB = 0x0004
81
+ CREATE_JOB = 0x0005
82
+ SEND_DOCUMENT = 0x0006
83
+ SEND_URI = 0x0007
84
+ CANCEL_JOB = 0x0008
85
+ GET_JOB_ATTRIBUTES = 0x0009
86
+ GET_JOBS = 0x000A
87
+ GET_PRINTER_ATTRIBUTES = 0x000B
88
+ HOLD_JOB = 0x000C
89
+ RELEASE_JOB = 0x000D
90
+ RESTART_JOB = 0x000E
91
+ PAUSE_PRINTER = 0x0010
92
+ RESUME_PRINTER = 0x0011
93
+ PURGE_JOBS = 0x0012
94
+ SET_PRINTER_ATTRIBUTES = 0x0013
95
+ SET_JOB_ATTRIBUTES = 0x0014
96
+ GET_PRINTER_SUPPORTED_VALUES = 0x0015
97
+ CREATE_PRINTER_SUBSCRIPTIONS = 0x0016
98
+ CREATE_JOB_SUBSCRIPTIONS = 0x0017
99
+ GET_SUBSCRIPTION_ATTRIBUTES = 0x0018
100
+ GET_SUBSCRIPTIONS = 0x0019
101
+ RENEW_SUBSCRIPTION = 0x001A
102
+ CANCEL_SUBSCRIPTION = 0x001B
103
+ GET_NOTIFICATIONS = 0x001C
104
+ SEND_NOTIFICATIONS = 0x001D
105
+ GET_RESOURCE_ATTRIBUTES = 0x001E
106
+ GET_RESOURCE_DATA = 0x001F
107
+ GET_RESOURCES = 0x0020
108
+ GET_PRINT_SUPPORT_FILES = 0x0021
109
+ ENABLE_PRINTER = 0x0022
110
+ DISABLE_PRINTER = 0x0023
111
+ PAUSE_PRINTER_AFTER_CURRENT_JOB = 0x0024
112
+ HOLD_NEW_JOBS = 0x0025
113
+ RELEASE_HELD_NEW_JOBS = 0x0026
114
+ DEACTIVATE_PRINTER = 0x0027
115
+ ACTIVATE_PRINTER = 0x0028
116
+ RESTART_PRINTER = 0x0029
117
+ SHUTDOWN_PRINTER = 0x002A
118
+ STARTUP_PRINTER = 0x002B
119
+ REPROCESS_JOB = 0x002C
120
+ CANCEL_CURRENT_JOB = 0x002D
121
+ SUSPEND_CURRENT_JOB = 0x002E
122
+ RESUME_JOB = 0x002F
123
+ PROMOTE_JOB = 0x0030
124
+ SCHEDULE_JOB_AFTER = 0x0031
125
+ CANCEL_DOCUMENT = 0x0033
126
+ GET_DOCUMENT_ATTRIBUTES = 0x0034
127
+ GET_DOCUMENTS = 0x0035
128
+ DELETE_DOCUMENT = 0x0036
129
+ SET_DOCUMENT_ATTRIBUTES = 0x0037
130
+ CANCEL_JOBS = 0x0038
131
+ CANCEL_MY_JOBS = 0x0039
132
+ RESUBMIT_JOB = 0x003A
133
+ CLOSE_JOB = 0x003B
134
+ IDENTIFY_PRINTER = 0x003C
135
+ VALIDATE_DOCUMENT = 0x003D
136
+ ADD_DOCUMENT_IMAGES = 0x003E
137
+ ACKNOWLEDGE_DOCUMENT = 0x003F
138
+ ACKNOWLEDGE_IDENTIFY_PRINTER = 0x0040
139
+ ACKNOWLEDGE_JOB = 0x0041
140
+ FETCH_DOCUMENT = 0x0042
141
+ FETCH_JOB = 0x0043
142
+ GET_OUTPUT_DEVICE_ATTRIBUTES = 0x0044
143
+ UPDATE_ACTIVE_JOBS = 0x0045
144
+ DEREGISTER_OUTPUT_DEVICE = 0x0046
145
+ UPDATE_DOCUMENT_STATUS = 0x0047
146
+ UPDATE_JOB_STATUS = 0x0048
147
+ UPDATE_OUTPUT_DEVICE_ATTRIBUTES = 0x0049
148
+ GET_NEXT_DOCUMENT_DATA = 0x004A
149
+ ALLOCATE_PRINTER_RESOURCES = 0x004B
150
+ CREATE_PRINTER = 0x004C
151
+ DEALLOCATE_PRINTER_RESOURCES = 0x004D
152
+ DELETE_PRINTER = 0x004E
153
+ GET_PRINTERS = 0x004F
154
+ SHUTDOWN_ONE_PRINTER = 0x0050
155
+ STARTUP_ONE_PRINTER = 0x0051
156
+ CANCEL_RESOURCE = 0x0052
157
+ CREATE_RESOURCE = 0x0053
158
+ INSTALL_RESOURCE = 0x0054
159
+ SEND_RESOURCE_DATA = 0x0055
160
+ SET_RESOURCE_ATTRIBUTES = 0x0056
161
+ CREATE_RESOURCE_SUBSCRIPTIONS = 0x0057
162
+ CREATE_SYSTEM_SUBSCRIPTIONS = 0x0058
163
+ DISABLE_ALL_PRINTERS = 0x0059
164
+ ENABLE_ALL_PRINTERS = 0x005A
165
+ GET_SYSTEM_ATTRIBUTES = 0x005B
166
+ GET_SYSTEM_SUPPORTED_VALUES = 0x005C
167
+ PAUSE_ALL_PRINTERS = 0x005D
168
+ PAUSE_ALL_PRINTERS_AFTER_CURRENT_JOB = 0x005E
169
+ REGISTER_OUTPUT_DEVICE = 0x005F
170
+ RESTART_SYSTEM = 0x0060
171
+ RESUME_ALL_PRINTERS = 0x0061
172
+ SET_SYSTEM_ATTRIBUTES = 0x0062
173
+ SHUTDOWN_ALL_PRINTER = 0x0063
174
+ STARTUP_ALL_PRINTERS = 0x0064
175
+ PRIVATE = 0x4000
176
+ CUPS_GET_DEFAULT = 0x4001
177
+ CUPS_GET_PRINTERS = 0x4002
178
+ CUPS_ADD_MODIFY_PRINTER = 0x4003
179
+ CUPS_DELETE_PRINTER = 0x4004
180
+ CUPS_GET_CLASSES = 0x4005
181
+ CUPS_ADD_MODIFY_CLASS = 0x4006
182
+ CUPS_DELETE_CLASS = 0x4007
183
+ CUPS_ACCEPT_JOBS = 0x4008
184
+ CUPS_REJECT_JOBS = 0x4009
185
+ CUPS_SET_DEFAULT = 0x400A
186
+ CUPS_GET_DEVICES = 0x400B
187
+ CUPS_GET_PPDS = 0x400C
188
+ CUPS_MOVE_JOB = 0x400D
189
+ CUPS_AUTHENTICATE_JOB = 0x400E
190
+ CUPS_GET_PPD = 0x400F
191
+ CUPS_GET_DOCUMENT = 0x4027
192
+ CUPS_CREATE_LOCAL_PRINTER = 0x4028
193
+
194
+
195
+ class IppTag(IntEnum):
196
+ """Represent the ENUMs of a tag."""
197
+
198
+ CUPS_INVALID = -1
199
+ ZERO = 0x00
200
+ OPERATION = 0x01
201
+ JOB = 0x02
202
+ END = 0x03
203
+ PRINTER = 0x04
204
+ UNSUPPORTED_GROUP = 0x05
205
+ SUBSCRIPTION = 0x06
206
+ EVENT_NOTIFICATION = 0x07
207
+ RESOURCE = 0x08
208
+ DOCUMENT = 0x09
209
+ SYSTEM = 0x0A
210
+ UNSUPPORTED_VALUE = 0x10
211
+ DEFAULT = 0x11
212
+ UNKNOWN = 0x12
213
+ NO_VALUE = 0x013
214
+ NOT_SETTABLE = 0x15
215
+ DELETE_ATTR = 0x16
216
+ ADMIN_DEFINE = 0x17
217
+ INTEGER = 0x21
218
+ BOOLEAN = 0x22
219
+ ENUM = 0x23
220
+ STRING = 0x30
221
+ DATE = 0x31
222
+ RESOLUTION = 0x32
223
+ RANGE = 0x33
224
+ BEGIN_COLLECTION = 0x34
225
+ TEXT_LANG = 0x35
226
+ NAME_LANG = 0x36
227
+ END_COLLECTION = 0x37
228
+ TEXT = 0x41
229
+ NAME = 0x42
230
+ RESERVED_STRING = 0x43
231
+ KEYWORD = 0x44
232
+ URI = 0x45
233
+ URI_SCHEME = 0x46
234
+ CHARSET = 0x47
235
+ LANGUAGE = 0x48
236
+ MIME_TYPE = 0x49
237
+ MEMBER_NAME = 0x4A
238
+ EXTENSION = 0x7F
239
+ CUPS_MASK = 0x7FFFFFFF
240
+ CUPS_CONST = -0x7FFFFFFF - 1
241
+
242
+
243
+ class IppJobState(IntEnum):
244
+ """Represent the ENUMs of the state of a print job."""
245
+
246
+ PENDING = 0x03
247
+ HELD = 0x04
248
+ PROCESSING = 0x05
249
+ STOPPED = 0x06
250
+ CANCELED = 0x07
251
+ ABORTED = 0x08
252
+ COMPLETED = 0x09
253
+
254
+
255
+ class IppDocumentState(IntEnum):
256
+ """Represent the ENUMs of the state of a document."""
257
+
258
+ PENDING = 0x03
259
+ PROCESSING = 0x05
260
+ CANCELED = 0x07
261
+ ABORTED = 0x08
262
+ COMPLETED = 0x08
263
+
264
+
265
+ class IppPrinterState(IntEnum):
266
+ """Represent the ENUMs of the state of a printer."""
267
+
268
+ IDLE = 0x0003
269
+ PROCESSING = 0x0004
270
+ STOPPED = 0x0005
271
+
272
+
273
+ class IppFinishing(IntEnum):
274
+ """Represent the ENUMs of the finishings attribute."""
275
+
276
+ NONE = 0x0003
277
+ STAPLE = 0x0004
278
+ PUNCH = 0x0005
279
+ COVER = 0x0006
280
+ BIND = 0x0007
281
+ SADDLE_STITCH = 0x0008
282
+ EDGE_STITCH = 0x0009
283
+ STAPLE_TOP_LEFT = 0x0014
284
+ STAPLE_BOTTOM_LEFT = 0x0015
285
+ STAPLE_TOP_RIGHT = 0x0016
286
+ STAPLE_BOTTOM_RIGHT = 0x0017
287
+ EDGE_STITCH_LEFT = 0x0018
288
+ EDGE_STITCH_TOP = 0x0019
289
+ EDGE_STITCH_RIGHT = 0x001A
290
+ EDGE_STITCH_BOTTOM = 0x001B
291
+ STAPLE_DUAL_LEFT = 0x001C
292
+ STAPLE_DUAL_TOP = 0x001D
293
+ STAPLE_DUAL_RIGHT = 0x001E
294
+ STAPLE_DUAL_BOTTOM = 0x001F
295
+ TRIM_AFTER_PAGES = 0x003C
296
+ TRIM_AFTER_DOCUMENTS = 0x003D
297
+ TRIM_AFTER_COPIES = 0x003E
298
+ TRIM_AFTER_JOB = 0x003F
299
+
300
+
301
+ class IppPrintQuality(IntEnum):
302
+ """Represent the ENUMs of the print-quality attribute."""
303
+
304
+ DRAFT = 0x0003
305
+ NORMAL = 0x0004
306
+ HIGH = 0x0005
307
+
308
+
309
+ class IppOrientationRequested(IntEnum):
310
+ """Represent the ENUMs of the orientation-requested attribute."""
311
+
312
+ PORTRAIT = 0x0003
313
+ LANDSCAPE = 0x0004
314
+ REVERSE_LANDSCAPE = 0x0005
315
+ REVERSE_PORTRAIT = 0x0006
316
+
317
+
318
+ ATTRIBUTE_ENUM_MAP = {
319
+ "document-state": IppDocumentState, # PWG5100.5
320
+ "finishings": IppFinishing, # RFC8011
321
+ "finishings-default": IppFinishing, # RFC8011
322
+ "finishings-supported": IppFinishing, # RFC8011
323
+ "job-state": IppJobState, # RFC8011
324
+ "media-source-feed-orientation": IppOrientationRequested, # PWG5100.7
325
+ "operations-supported": IppOperation, # RFC8011
326
+ "orientation-requested": IppOrientationRequested, # RFC8011
327
+ "orientation-requested-default": IppOrientationRequested, # RFC8011
328
+ "orientation-requested-supported": IppOrientationRequested, # RFC8011
329
+ "printer-state": IppPrinterState, # RFC8011
330
+ "print-quality": IppPrintQuality, # RFC8011
331
+ "print-quality-default": IppPrintQuality, # RFC8011
332
+ "print-quality-supported": IppPrintQuality, # RFC8011
333
+ "status-code": IppStatus, # RFC8011
334
+ }
pyipp/exceptions.py ADDED
@@ -0,0 +1,25 @@
1
+ """Exceptions for IPP."""
2
+
3
+
4
+ class IPPError(Exception):
5
+ """Generic IPP exception."""
6
+
7
+
8
+ class IPPConnectionError(IPPError):
9
+ """IPP connection exception."""
10
+
11
+
12
+ class IPPConnectionUpgradeRequired(IPPError): # noqa: N818
13
+ """IPP connection upgrade requested."""
14
+
15
+
16
+ class IPPParseError(IPPError):
17
+ """IPP parse exception."""
18
+
19
+
20
+ class IPPResponseError(IPPError):
21
+ """IPP response exception."""
22
+
23
+
24
+ class IPPVersionNotSupportedError(IPPError):
25
+ """IPP version not supported."""