-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support appending pre-encoded data when serializing (#510)
* add print_job data * Apply suggestions from code review --------- Co-authored-by: Chris Talkington <chris@talkingtontech.com>
- Loading branch information
1 parent
e626e4e
commit 2bfeafa
Showing
2 changed files
with
37 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# pylint: disable=W0621 | ||
"""Asynchronous Python client for IPP.""" | ||
import asyncio | ||
|
||
from pyipp import IPP | ||
from pyipp.enums import IppOperation | ||
|
||
|
||
async def main() -> None: | ||
|
||
pdf_file = '/path/to/pdf.pfd' | ||
with open(pdf_file, 'rb') as f: | ||
content = f.read() | ||
|
||
"""Show example of executing operation against your IPP print server.""" | ||
async with IPP("ipp://192.168.1.92:631/ipp/print") as ipp: | ||
response = await ipp.execute( | ||
IppOperation.PRINT_JOB, | ||
{ | ||
"operation-attributes-tag": { | ||
"requesting-user-name": "Me", | ||
"job-name": "My Test Job", | ||
"document-format": "application/pdf", | ||
}, | ||
'data': content, | ||
}, | ||
) | ||
|
||
print(response) | ||
|
||
|
||
if __name__ == "__main__": | ||
loop = asyncio.get_event_loop() | ||
loop.run_until_complete(main()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters