diff --git a/examples/execute.py b/examples/execute.py new file mode 100644 index 000000000..f2598ad58 --- /dev/null +++ b/examples/execute.py @@ -0,0 +1,49 @@ +# pylint: disable=W0621 +"""Asynchronous Python client for IPP.""" +import asyncio + +from pyipp import IPP +from pyipp.enums import IppOperation + + +async def main() -> None: + """Show example of executing operation against your IPP print server.""" + async with IPP("ipps://192.168.1.92:631/ipp/print") as ipp: + response = await ipp.execute( + IppOperation.GET_PRINTER_ATTRIBUTES, + { + "operation-attributes-tag": { + "requested-attributes": [ + "printer-device-id", + "printer-name", + "printer-type", + "printer-location", + "printer-info", + "printer-make-and-model", + "printer-state", + "printer-state-message", + "printer-state-reason", + "printer-supply", + "printer-up-time", + "printer-uri-supported", + "device-uri", + "printer-is-shared", + "printer-more-info", + "printer-firmware-string-version", + "marker-colors", + "marker-high-levels", + "marker-levels", + "marker-low-levels", + "marker-names", + "marker-types", + ], + }, + }, + ) + + print(response) + + +if __name__ == "__main__": + loop = asyncio.get_event_loop() + loop.run_until_complete(main())