giovanni Posted February 28, 2023 Share Posted February 28, 2023 alfred-kindle 📚 Motivation ✅ - Quickly list, search, and open your Kindle books Setting up ⚙️ - Alfred 5 with Powerpack license - Python3 - Kindle app installed Default settings - In Alfred, open the Configure Workflow menu in alfred-kindle preferences - set the keyword for the workflow (default: !k) - set the book content icon, i.e. if a book has been downloaded locally (default: 📘) - show 'ghost' books (i.e. books not downloaded, or previously loaned)? (default: yes) - set search scope (default: 'Title') - Title: search titles only - Author: search authors only - Both: search across titles and authors Basic Usage 📖 - launch with keyword (default: !k), or custom hotkey - enter ↩️ will open the book in Kindle (if downloaded) or the corresponding webpage on Amazon (if not downloaded) Limitations & known issues ⚠️ - None for now, but I have not done extensive testing, let me know if you see anything! - tested with ~100 books. The book list is currently created on the fly, and book covers are downloaded if missing. Might be slower if your library has thousands of books, in which case a sqlite database it might be more efficient. Let me know if that is the case! - not tested thoroughly for user-uploaded documents. - tested with Python 3.9.13 Acknowledgments 😀 - Thanks to the Alfred forum community! - Icon from SF symbols Changelog 🧰 - 02-28-2023: version 0.1 Feedback 🧐 Feedback welcome! If you notice a bug, or have ideas for new features, please feel free to get in touch either on [Github](https://github.com/giovannicoppola/alfred-kindle), or here. Download ⬇️ | Github Link to comment
vitor Posted February 28, 2023 Share Posted February 28, 2023 (edited) Looks good, will be adding this for the Gallery list! Though if you make a quick post in the submissions forum, it’ll help with prioritisation. Quick note: the icon is low resolution, to the point it looks blurry even in Alfred results. When exporting from SF Symbols, be sure to set it to 256 so it looks crisp. Another thing to note is that by being monochromatic (and white) it’ll disappear when the background is of the same colour. https://font2png.com is also a great source for icons, and even lets you make background with rounded corners. Also, you don’t need to add the icon to the Keyword. In objects where you want the workflow’s icon to be used, leave the icon empty. Edited February 28, 2023 by vitor Link to comment
giovanni Posted March 1, 2023 Author Share Posted March 1, 2023 thanks @vitor! I made those changes. I will add a post to the Gallery list, perhaps after a few users test it and don't find huge bugs 😅 vitor 1 Link to comment
luciano Posted December 31, 2023 Share Posted December 31, 2023 This doesn't work for me. In the debugger I see line below. Anyone know what problem is? [17:27:21.623] ERROR: alfred-kindle[Script Filter] Code 1: File "kindle-query.py", line 26 Link to comment
giovanni Posted December 31, 2023 Author Share Posted December 31, 2023 @luciano can you share the complete debugger message? Also, are you using Kindle or Kindle Classic? Link to comment
luciano Posted December 31, 2023 Share Posted December 31, 2023 Hopefully the below is what you need. I was using the new Kindle app. Downloaded Kindle Classic app but still not working. SyntaxError: invalid syntax [21:31:14.584] alfred-kindle[Script Filter] Queuing argument 'cofta' [21:31:14.703] alfred-kindle[Script Filter] Script with argv 'cofta' finished [21:31:14.707] ERROR: alfred-kindle[Script Filter] Code 1: File "kindle-query.py", line 26 FROM Book """ Link to comment
giovanni Posted December 31, 2023 Author Share Posted December 31, 2023 the debugger ends like that, with a truncated line? I removed it in this version, but it did not cause problems before. What python version are you using? Link to comment
luciano Posted January 1 Share Posted January 1 I updated Python to latest version and books still not being found. Below is output from debugger, there's a few lines containing ERROR. Should I be using the updated 'Kindle' app or the old 'Kindle Classic' app? [08:06:05.246] alfred-kindle[Script Filter] Queuing argument '(null)' [08:06:05.553] alfred-kindle[Script Filter] Script with argv '(null)' finished [08:06:05.555] ERROR: alfred-kindle[Script Filter] Code 1: retrieving image/Users/rossahmed2/Library/Caches/com.runningwithcrayons.Alfred/Workflow Data/giovanni.alfred-kindle/images/B081SDJHJN.01 Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/urllib/request.py", line 1344, in do_open h.request(req.get_method(), req.selector, req.data, headers, File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/http/client.py", line 1327, in request self._send_request(method, url, body, headers, encode_chunked) File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/http/client.py", line 1373, in _send_request self.endheaders(body, encode_chunked=encode_chunked) File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/http/client.py", line 1322, in endheaders self._send_output(message_body, encode_chunked=encode_chunked) File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/http/client.py", line 1081, in _send_output self.send(msg) File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/http/client.py", line 1025, in send self.connect() File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/http/client.py", line 1468, in connect self.sock = self._context.wrap_socket(self.sock, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/ssl.py", line 455, in wrap_socket return self.sslsocket_class._create( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/ssl.py", line 1046, in _create self.do_handshake() File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/ssl.py", line 1321, in do_handshake self._sslobj.do_handshake() ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1000) During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/Users/rossahmed2/Library/Application Support/Alfred/Alfred.alfredpreferences/workflows/user.workflow.A74657B2-4B66-41EE-8CE9-A70527E9BAD2/kindle-query.py", line 210, in <module> main () File "/Users/rossahmed2/Library/Application Support/Alfred/Alfred.alfredpreferences/workflows/user.workflow.A74657B2-4B66-41EE-8CE9-A70527E9BAD2/kindle-query.py", line 204, in main getXML(XML_CACHE, myContentBooks) File "/Users/rossahmed2/Library/Application Support/Alfred/Alfred.alfredpreferences/workflows/user.workflow.A74657B2-4B66-41EE-8CE9-A70527E9BAD2/kindle-query.py", line 176, in getXML urllib.request.urlretrieve(f"{MY_URL_STRING}{book['ASIN']}.01", ICON_PATH) File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/urllib/request.py", line 240, in urlretrieve with contextlib.closing(urlopen(url, data)) as fp: ^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/urllib/request.py", line 215, in urlopen return opener.open(url, data, timeout) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/urllib/request.py", line 515, in open response = self._open(req, data) ^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/urllib/request.py", line 532, in _open result = self._call_chain(self.handle_open, protocol, protocol + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/urllib/request.py", line 492, in _call_chain result = func(*args) ^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/urllib/request.py", line 1392, in https_open return self.do_open(http.client.HTTPSConnection, req, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/urllib/request.py", line 1347, in do_open raise URLError(err) urllib.error.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1000)> [08:06:05.838] alfred-kindle[Script Filter] Queuing argument 'F' [08:06:06.123] alfred-kindle[Script Filter] Queuing argument 'Fl' [08:06:06.220] alfred-kindle[Script Filter] Script with argv 'F' finished [08:06:06.222] ERROR: alfred-kindle[Script Filter] Code 1: retrieving image/Users/rossahmed2/Library/Caches/com.runningwithcrayons.Alfred/Workflow Data/giovanni.alfred-kindle/images/B081SDJHJN.01 Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/urllib/request.py", line 1344, in do_open h.request(req.get_method(), req.selector, req.data, headers, File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/http/client.py", line 1327, in request self._send_request(method, url, body, headers, encode_chunked) File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/http/client.py", line 1373, in _send_request self.endheaders(body, encode_chunked=encode_chunked) File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/http/client.py", line 1322, in endheaders self._send_output(message_body, encode_chunked=encode_chunked) File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/http/client.py", line 1081, in _send_output self.send(msg) File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/http/client.py", line 1025, in send self.connect() File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/http/client.py", line 1468, in connect self.sock = self._context.wrap_socket(self.sock, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/ssl.py", line 455, in wrap_socket return self.sslsocket_class._create( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/ssl.py", line 1046, in _create self.do_handshake() File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/ssl.py", line 1321, in do_handshake self._sslobj.do_handshake() ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1000) During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/Users/rossahmed2/Library/Application Support/Alfred/Alfred.alfredpreferences/workflows/user.workflow.A74657B2-4B66-41EE-8CE9-A70527E9BAD2/kindle-query.py", line 210, in <module> main () File "/Users/rossahmed2/Library/Application Support/Alfred/Alfred.alfredpreferences/workflows/user.workflow.A74657B2-4B66-41EE-8CE9-A70527E9BAD2/kindle-query.py", line 204, in main getXML(XML_CACHE, myContentBooks) File "/Users/rossahmed2/Library/Application Support/Alfred/Alfred.alfredpreferences/workflows/user.workflow.A74657B2-4B66-41EE-8CE9-A70527E9BAD2/kindle-query.py", line 176, in getXML urllib.request.urlretrieve(f"{MY_URL_STRING}{book['ASIN']}.01", ICON_PATH) File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/urllib/request.py", line 240, in urlretrieve with contextlib.closing(urlopen(url, data)) as fp: ^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/urllib/request.py", line 215, in urlopen return opener.open(url, data, timeout) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/urllib/request.py", line 515, in open response = self._open(req, data) ^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/urllib/request.py", line 532, in _open result = self._call_chain(self.handle_open, protocol, protocol + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/urllib/request.py", line 492, in _call_chain result = func(*args) ^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/urllib/request.py", line 1392, in https_open return self.do_open(http.client.HTTPSConnection, req, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/urllib/request.py", line 1347, in do_open raise URLError(err) urllib.error.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1000)> [08:06:06.345] alfred-kindle[Script Filter] Queuing argument 'Fli' [08:06:06.469] alfred-kindle[Script Filter] Queuing argument 'Flig' [08:06:06.534] alfred-kindle[Script Filter] Script with argv 'Fl' finished [08:06:06.540] ERROR: alfred-kindle[Script Filter] Code 1: retrieving image/Users/rossahmed2/Library/Caches/com.runningwithcrayons.Alfred/Workflow Data/giovanni.alfred-kindle/images/B019JPNL2K.01 Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/urllib/request.py", line 1344, in do_open h.request(req.get_method(), req.selector, req.data, headers, File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/http/client.py", line 1327, in request self._send_request(method, url, body, headers, encode_chunked) File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/http/client.py", line 1373, in _send_request self.endheaders(body, encode_chunked=encode_chunked) File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/http/client.py", line 1322, in endheaders self._send_output(message_body, encode_chunked=encode_chunked) File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/http/client.py", line 1081, in _send_output self.send(msg) File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/http/client.py", line 1025, in send self.connect() File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/http/client.py", line 1468, in connect self.sock = self._context.wrap_socket(self.sock, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/ssl.py", line 455, in wrap_socket return self.sslsocket_class._create( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/ssl.py", line 1046, in _create self.do_handshake() File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/ssl.py", line 1321, in do_handshake self._sslobj.do_handshake() ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1000) During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/Users/rossahmed2/Library/Application Support/Alfred/Alfred.alfredpreferences/workflows/user.workflow.A74657B2-4B66-41EE-8CE9-A70527E9BAD2/kindle-query.py", line 210, in <module> main () File "/Users/rossahmed2/Library/Application Support/Alfred/Alfred.alfredpreferences/workflows/user.workflow.A74657B2-4B66-41EE-8CE9-A70527E9BAD2/kindle-query.py", line 204, in main getXML(XML_CACHE, myContentBooks) File "/Users/rossahmed2/Library/Application Support/Alfred/Alfred.alfredpreferences/workflows/user.workflow.A74657B2-4B66-41EE-8CE9-A70527E9BAD2/kindle-query.py", line 167, in getXML urllib.request.urlretrieve(f"{MY_URL_STRING}{book['ASIN']}.01", ICON_PATH) File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/urllib/request.py", line 240, in urlretrieve with contextlib.closing(urlopen(url, data)) as fp: ^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/urllib/request.py", line 215, in urlopen return opener.open(url, data, timeout) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/urllib/request.py", line 515, in open response = self._open(req, data) ^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/urllib/request.py", line 532, in _open result = self._call_chain(self.handle_open, protocol, protocol + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/urllib/request.py", line 492, in _call_chain result = func(*args) ^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/urllib/request.py", line 1392, in https_open return self.do_open(http.client.HTTPSConnection, req, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/urllib/request.py", line 1347, in do_open raise URLError(err) urllib.error.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1000)> [08:06:06.572] alfred-kindle[Script Filter] Queuing argument 'Fligh' [08:06:06.648] alfred-kindle[Script Filter] Queuing argument 'Flight' [08:06:06.921] alfred-kindle[Script Filter] Script with argv 'Flig' finished [08:06:06.923] ERROR: alfred-kindle[Script Filter] Code 1: retrieving image/Users/rossahmed2/Library/Caches/com.runningwithcrayons.Alfred/Workflow Data/giovanni.alfred-kindle/images/B019JPNL2K.01 Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/urllib/request.py", line 1344, in do_open h.request(req.get_method(), req.selector, req.data, headers, File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/http/client.py", line 1327, in request self._send_request(method, url, body, headers, encode_chunked) File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/http/client.py", line 1373, in _send_request self.endheaders(body, encode_chunked=encode_chunked) File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/http/client.py", line 1322, in endheaders self._send_output(message_body, encode_chunked=encode_chunked) File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/http/client.py", line 1081, in _send_output self.send(msg) File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/http/client.py", line 1025, in send self.connect() File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/http/client.py", line 1468, in connect self.sock = self._context.wrap_socket(self.sock, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/ssl.py", line 455, in wrap_socket return self.sslsocket_class._create( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/ssl.py", line 1046, in _create self.do_handshake() File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/ssl.py", line 1321, in do_handshake self._sslobj.do_handshake() ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1000) During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/Users/rossahmed2/Library/Application Support/Alfred/Alfred.alfredpreferences/workflows/user.workflow.A74657B2-4B66-41EE-8CE9-A70527E9BAD2/kindle-query.py", line 210, in <module> main () File "/Users/rossahmed2/Library/Application Support/Alfred/Alfred.alfredpreferences/workflows/user.workflow.A74657B2-4B66-41EE-8CE9-A70527E9BAD2/kindle-query.py", line 204, in main getXML(XML_CACHE, myContentBooks) File "/Users/rossahmed2/Library/Application Support/Alfred/Alfred.alfredpreferences/workflows/user.workflow.A74657B2-4B66-41EE-8CE9-A70527E9BAD2/kindle-query.py", line 167, in getXML urllib.request.urlretrieve(f"{MY_URL_STRING}{book['ASIN']}.01", ICON_PATH) File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/urllib/request.py", line 240, in urlretrieve with contextlib.closing(urlopen(url, data)) as fp: ^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/urllib/request.py", line 215, in urlopen return opener.open(url, data, timeout) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/urllib/request.py", line 515, in open response = self._open(req, data) ^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/urllib/request.py", line 532, in _open result = self._call_chain(self.handle_open, protocol, protocol + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/urllib/request.py", line 492, in _call_chain result = func(*args) ^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/urllib/request.py", line 1392, in https_open return self.do_open(http.client.HTTPSConnection, req, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/urllib/request.py", line 1347, in do_open raise URLError(err) urllib.error.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1000)> [08:06:07.284] alfred-kindle[Script Filter] Script with argv 'Flight' finished [08:06:07.291] ERROR: alfred-kindle[Script Filter] Code 1: retrieving image/Users/rossahmed2/Library/Caches/com.runningwithcrayons.Alfred/Workflow Data/giovanni.alfred-kindle/images/B019JPNL2K.01 Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/urllib/request.py", line 1344, in do_open h.request(req.get_method(), req.selector, req.data, headers, File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/http/client.py", line 1327, in request self._send_request(method, url, body, headers, encode_chunked) File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/http/client.py", line 1373, in _send_request self.endheaders(body, encode_chunked=encode_chunked) File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/http/client.py", line 1322, in endheaders self._send_output(message_body, encode_chunked=encode_chunked) File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/http/client.py", line 1081, in _send_output self.send(msg) File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/http/client.py", line 1025, in send self.connect() File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/http/client.py", line 1468, in connect self.sock = self._context.wrap_socket(self.sock, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/ssl.py", line 455, in wrap_socket return self.sslsocket_class._create( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/ssl.py", line 1046, in _create self.do_handshake() File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/ssl.py", line 1321, in do_handshake self._sslobj.do_handshake() ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1000) During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/Users/rossahmed2/Library/Application Support/Alfred/Alfred.alfredpreferences/workflows/user.workflow.A74657B2-4B66-41EE-8CE9-A70527E9BAD2/kindle-query.py", line 210, in <module> main () File "/Users/rossahmed2/Library/Application Support/Alfred/Alfred.alfredpreferences/workflows/user.workflow.A74657B2-4B66-41EE-8CE9-A70527E9BAD2/kindle-query.py", line 204, in main getXML(XML_CACHE, myContentBooks) File "/Users/rossahmed2/Library/Application Support/Alfred/Alfred.alfredpreferences/workflows/user.workflow.A74657B2-4B66-41EE-8CE9-A70527E9BAD2/kindle-query.py", line 167, in getXML urllib.request.urlretrieve(f"{MY_URL_STRING}{book['ASIN']}.01", ICON_PATH) File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/urllib/request.py", line 240, in urlretrieve with contextlib.closing(urlopen(url, data)) as fp: ^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/urllib/request.py", line 215, in urlopen return opener.open(url, data, timeout) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/urllib/request.py", line 515, in open response = self._open(req, data) ^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/urllib/request.py", line 532, in _open result = self._call_chain(self.handle_open, protocol, protocol + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/urllib/request.py", line 492, in _call_chain result = func(*args) ^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/urllib/request.py", line 1392, in https_open return self.do_open(http.client.HTTPSConnection, req, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/urllib/request.py", line 1347, in do_open raise URLError(err) urllib.error.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1000)> Link to comment
giovanni Posted January 1 Author Share Posted January 1 (edited) @luciano it's failing to fetch the book covers. I can add an error handling to skip the covers that fail, but I am curious why it is happening. I tried your cover and I can see it. Can you access this link in your browser? https://ecx.images-amazon.com/images/P/B081SDJHJN.01 is this the amazon link for the book? https://www.amazon.com/Gambell-Lawrence-Island-Studies-Western-ebook/dp/B081SDJHJN what OS are you on? which country/amazon market are you on? your URL root might be different Edited January 1 by giovanni Link to comment
vitor Posted January 1 Share Posted January 1 8 hours ago, luciano said: [SSL: CERTIFICATE_VERIFY_FAILED] If you installed Python from their website (as opposed to using the Homebrew version), you have to install the certificates too. giovanni 1 Link to comment
luciano Posted January 1 Share Posted January 1 Installing the certificates has fixed it thanks. Is it possible it can work with the new Kindle app (rather than Kindle Classic) as Kindle Classic now crashes regularly on my computer. Link to comment
giovanni Posted January 1 Author Share Posted January 1 1 hour ago, luciano said: Installing the certificates has fixed it thanks. great to hear! 1 hour ago, luciano said: Is it possible it can work with the new Kindle app I deleted Kindle Classic and the workflow seems to work except it won't open dowloaded books in the new kindle app. is that your experience as well? Link to comment
luciano Posted January 2 Share Posted January 2 I deleted Kindle Classic and just kept the new Kindle app, but there were no results when I typed author/names of books. Link to comment
luciano Posted January 9 Share Posted January 9 Below is text from debugger [14:28:26.140] alfred-kindle[Script Filter] Queuing argument '(null)' [14:28:26.445] alfred-kindle[Script Filter] Script with argv '(null)' finished [14:28:26.449] ERROR: alfred-kindle[Script Filter] Code 1: Traceback (most recent call last): File "/Users/rossahmed2/Library/Application Support/Alfred/Alfred.alfredpreferences/workflows/user.workflow.A5418044-1F5C-49C7-AF20-E380D3ED64DD/kindle-query.py", line 210, in <module> main () File "/Users/rossahmed2/Library/Application Support/Alfred/Alfred.alfredpreferences/workflows/user.workflow.A5418044-1F5C-49C7-AF20-E380D3ED64DD/kindle-query.py", line 204, in main getXML(XML_CACHE, myContentBooks) File "/Users/rossahmed2/Library/Application Support/Alfred/Alfred.alfredpreferences/workflows/user.workflow.A5418044-1F5C-49C7-AF20-E380D3ED64DD/kindle-query.py", line 113, in getXML with open(myFile) as xml_file: ^^^^^^^^^^^^ FileNotFoundError: [Errno 2] No such file or directory: '/Cache/KindleSyncMetadataCache.xml' [14:28:26.451] alfred-kindle[Script Filter] {"items": [{"title": "Error: Cannot find Kindle directory", "subtitle": "/My Kindle Content/", "arg": "", "icon": {"path": "icons/Warning.png"}}]} Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now