pycups icon indicating copy to clipboard operation
pycups copied to clipboard

Example for IPPRequest with IPPAttribute ('hold-new-jobs')

Open LarsBeugelaar opened this issue 5 years ago • 0 comments

Hi, I am trying to get my cups printer to 'hold-new-jobs', but its not cear to me how I should do an IPPRequest with the necessary IPPAttribue(s) and handle the response. The callback response is a set of bytes and the repsonse of writeIO is -1. Maybe an example can be added to the repo? I have tried the following:

# Response is a set of bytes. Not clear (to me) what it means and if its parsed or can be parsed somewhere.
def ipp_hold_new_jobs_request_handler(response):
    print("Hold_all_jobs handler called. Response: {}".format(response))


ipp_request = cups.IPPRequest(cups.IPP_OP_HOLD_NEW_JOBS)
ipp_attribute = cups.IPPAttribute(cups.IPP_TAG_OPERATION, cups.IPP_TAG_URI, "printer-uri",
                                  "ipp://cups.beugelaar.hq/printers/prt0")
ipp_request.add(ipp_attribute)
response = ipp_request.writeIO(ipp_hold_new_jobs_request_handler)
print('repsonse: {}'.format(response))

I have also posted a question about what I want to accomplish on stackoverflow: https://stackoverflow.com/questions/62741730/pycups-create-and-send-ipprequest-with-ippattribute-and-parse-response-enable

Thanks in advance.

LarsBeugelaar avatar Jul 06 '20 14:07 LarsBeugelaar