Closed slingamn closed 2 years ago
@slingamn please use
https://openprinting.org/query.php
instead of
https://openprinting.org/query.cgi
but the same API. This is still working as expected.
Example:
https://openprinting.org/query.php?type=printer&make=HP
This shows all HP printers.
Thanks, with this change to the query URI (not included in the branch) I was able to test the two changed components (cupshelpers.openprinting.OpenPrinting
and newprinter.download_gpg_fingerprint
) in isolation. I'm pretty sure they're correct.
Leaving this as two commits for now, I'll clean up the history later.
Can I provide any more testing or information on this change? Thanks for your help.
@slingamn hmm, it seems github didn't show a comment until I click 'start a review'. I wrote the comment on the code two weeks ago...
One thing that came up in my testing: 15 seconds seems like it might be too short a timeout for this API? I'd welcome any suggestions on this issue.
@slingamn I've answered in the comment - I would let the current timeout and enhanced the exception handling so we could be easily found out if it timed out and raise the timeout in the future.
That makes sense. Is debugprint
the correct error reporting mechanism to use?
@slingamn yep, IMO debugprint() function is our most viable option.
The code looks fine, would you mind providing steps how to check if it works?
Here's a snippet that tests the openprinting API query:
import time
import cupshelpers.openprinting
print(cupshelpers.openprinting.__file__)
def callback(a, b, c):
print("callback returned", a, b, c)
o = cupshelpers.openprinting.OpenPrinting()
result = o.webQuery(parameters={'type': 'printer', 'make': 'HP'}, callback=callback)
# sleep to allow async callback to complete
time.sleep(100)
For the GPG fingerprint code:
from newprinter import download_gpg_fingerprint
print(download_gpg_fingerprint('https://intouch.ebz.epson.net/key/fingerprint'))
Test results:
>>> result = o.webQuery(parameters={'type': 'printer', 'make': 'HP'}, callback=callback)
>>> timecallback returned 0 None b'HP-2000C|HP|2000C\nHP-2500C|HP|2500C\nHP-2500CM|HP|2500CM\nHP-2563|HP|2563\nHP-910|HP|910\nHP-915|HP|915\nHP-Business_Inkjet_1000|HP|Business Inkjet 1000\n ...
>>> from newprinter import download_gpg_fingerprint
Unable to init server: Could not connect: Connection refused
Unable to init server: Could not connect: Connection refused
>>> print(download_gpg_fingerprint('https://intouch.ebz.epson.net/key/fingerprint'))
XXXXXXXXXXXX <- real fingerprint here
LGTM ('connection refused' messages are there because I tested it on server machine and X11 server wasn't running), merging.
Thank you for the PR!
@zdohnal could you spin a release of system-config-printer in time before Feature Freeze of Ubuntu 22.04 LTS on Feb 24? The Removal of the dependency on python3-requests as this is the last dependency on python3-requests in Ubuntu 22.04 which allows dropping the package from the distro.
Thanks in advance.
Hi Till,
I hope I'll manage that - I'm currently deep in security vulnerabilities in other packages I maintain, so once that is solved and no more new come, I should be able to release s-c-p.
I have done the 1.5.16 release now, simply from today's GIT state of the art. A year of bug fixes and translations for Ubuntu 22.04 LTS.
At this stage, this is mostly just a request for comments. I'm trying to remove python3-requests as a dependency of the Ubuntu base system. This project has been mostly successful for the server edition, since these patches made it possible to run Ubuntu 21.04 and later without python3-requests:
For 22.04 I'd like to remove it as a dependency of the desktop system as well. I think system-config-printer is the only "core" package that still depends on it, so here's a draft of a patch that removes the dependency.
I wasn't sure how best to test these changes. The API at
https://openprinting.org/query.cgi
seems to be down or misconfigured right now?Thanks very much for your time.