Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Querying "document-format" (mimeMediaType) / RFC 2911 Section 3.2.5.1 , Page 50 #371

Open
ifrh opened this issue Nov 3, 2022 · 3 comments

Comments

@ifrh
Copy link

ifrh commented Nov 3, 2022

I have a SAMSUNG SCX 4828FN
After I changed inside pyipp/const.py the protocoll version to DEFAULT_PROTO_VERSION = (1, 1) a light modificated example code, based upon https://github.com/ctalkington/python-ipp#usage , gives me.

Printer(info=Info(name='Samsung SCX-4x28 Series', printer_name='Printer Name', printer_uri_supported='http://192.168.0.5:631', uptime=8403, command_set=None, location='Printer Location', manufacturer='Samsung', model='SCX-4x28 Series', printer_info='Info', serial=None, uuid=None, version=None, more_info='MoreInfo'), markers=[], state=State(printer_state='idle', reasons=None, message='Idle. Printer is ready to print.'), uris=[])

Can I use your project code to query the IPP printer for its supported mimeMediaType?
https://datatracker.ietf.org/doc/html/rfc2911#section-3.2.5.1

Perhaps I had overseen something obvious?

From the printers SyncThru WebService Page I know the information:


Main Firmware Version : | 1.01.00.36      10-29-2009
Network Firmware Version : | V4.01.18(4x24/26/28) 11-17-2009
Engine Firmware Version : | 1.00.11
PCL5E Firmware Version : | PCL5e 5.92 02-12-2009 |  
PCLXL Firmware Version : | PCL6 5.93  03-21-2009 |  
PS3 Firmware Version : | PS3 1.94.06 12-22-2008 |  
TIFF Firmware Version : | TIFF 0.91.00 10-07-2008

By the way, if I use protocoll version DEFAULT_PROTO_VERSION = (2, 0)
than your Code crashes while parsing the printers response.:

Traceback (most recent call last):
  File "/home/rhartm2m/miniconda2/envs/IppSyncThru/lib/python3.9/site-packages/pyipp/ipp.py", line 188, in execute
    parsed = parse_response(response)
  File "/home/rhartm2m/miniconda2/envs/IppSyncThru/lib/python3.9/site-packages/pyipp/parser.py", line 260, in parse
    if isinstance(data[attribute_key], list):
KeyError: ''

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/rhartm2m/IppSyncThru_Check/my_pyipp_example.py", line 20, in <module>
    loop.run_until_complete(main())
  File "/home/rhartm2m/miniconda2/envs/IppSyncThru/lib/python3.9/asyncio/base_events.py", line 647, in run_until_complete
    return future.result()
  File "/home/rhartm2m/IppSyncThru_Check/my_pyipp_example.py", line 14, in main
    printer: Printer = await ipp.printer()
  File "/home/rhartm2m/miniconda2/envs/IppSyncThru/lib/python3.9/site-packages/pyipp/ipp.py", line 216, in printer
    response_data = await self.execute(
  File "/home/rhartm2m/miniconda2/envs/IppSyncThru/lib/python3.9/site-packages/pyipp/ipp.py", line 190, in execute
    raise IPPParseError from exc
pyipp.exceptions.IPPParseError


@ctalkington
Copy link
Owner

you'd likely want to use the raw method like in:

https://github.com/ctalkington/python-ipp/blob/7c5c57079499cc75d116d5678b6569ea969e273d/examples/debug.py

This is mainly cause currently that attribute isn't mapped to a python dataclass so the printer method would not expose the data even if it didnt fail plus with raw you can dictate ipp version by overriding version property.

@ctalkington
Copy link
Owner

Actually that would only get you the raw bytes which would need parsed. so execute would handle taking your custom request and getting parsed but not modeled data back.

https://github.com/ctalkington/python-ipp/blob/bf53c3db4a481d3543a7bfff176e112b4a12f33d/examples/execute.py

@ctalkington
Copy link
Owner

ctalkington commented May 27, 2023

that error would mean there was not attribute set/found/understood when parsing request. I may try to recreate such a case as that does look like a potential problem

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants