gingerbeardman Posted February 12, 2021 Share Posted February 12, 2021 Any ideas why the URL call from Python is failing? Workflow in question: https://www.alfredforum.com/topic/8418-apple-music-search-with-alfred/ [14:30:20.771] Search Apple Music[Script Filter] Queuing argument 'charlatans' [14:30:21.205] Search Apple Music[Script Filter] Script with argv '(null)' finished [14:30:21.208] ERROR: Search Apple Music[Script Filter] Code 1: Traceback (most recent call last): File "album.py", line 33, in <module> data = urllib.urlopen(url, params).read() File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib.py", line 89, in urlopen return opener.open(url, data) File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib.py", line 215, in open return getattr(self, name)(url, data) File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib.py", line 460, in open_https data) File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib.py", line 379, in http_error result = method(url, fp, errcode, errmsg, headers, data) File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib.py", line 673, in http_error_301 return self.http_error_302(url, fp, errcode, errmsg, headers, data) File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib.py", line 642, in http_error_302 headers, data) File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib.py", line 669, in redirect_internal return self.open(newurl) File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib.py", line 213, in open return getattr(self, name)(url) File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib.py", line 443, in open_https h.endheaders(data) File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 1038, in endheaders self._send_output(message_body) File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 882, in _send_output self.send(msg) File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 844, in send self.connect() File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 1255, in connect HTTPConnection.connect(self) File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 821, in connect self.timeout, self.source_address) File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/socket.py", line 557, in create_connection for res in getaddrinfo(host, port, 0, SOCK_STREAM): IOError: [Errno socket error] [Errno 8] nodename nor servname provided, or not known Link to comment
deanishe Posted February 12, 2021 Share Posted February 12, 2021 Apple's server redirects to a different server that isn't responding. The error Python is throwing normally happens when it can't find the server by name (i.e. DNS resolution error). In this case, it might be because the server it's being redirected to doesn't have a hostname (it's just an IP address), but it's using HTTPS, which technically require a hostname, not an IP address. Link to comment
gingerbeardman Posted February 12, 2021 Author Share Posted February 12, 2021 Interesting. Thanks! I'd did some manual API queries through my browser and they worked fine. I didn't spot any redirection. What redirects are you seeing? Link to comment
deanishe Posted February 12, 2021 Share Posted February 12, 2021 It was redirecting me to https://17.124.168.180/search?term=['my\\+search\\+query']&country=GB&app=music&entity=album&limit=15&media=apple_music, though not consistently. gingerbeardman 1 Link to comment
gingerbeardman Posted March 17, 2021 Author Share Posted March 17, 2021 Very odd, thanks for looking. I've had to stop using this workflow until I can find time to investigate if there's a workaround. Link to comment
gingerbeardman Posted March 17, 2021 Author Share Posted March 17, 2021 This issue was resolved by removing some of the URL query parameters, see workflow thread. 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