Bug #6260
tvhmeta not able to authenticate to the tvh api
0%
Description
When a username and password are supplied to tvhmeta, urlopen() can't grok the URL that tvhmeta constructs for the tvh api - eg http://user:pass@hostname:portnum/url, and instead treats 'user:pass@hostname' as the whole hostname. I'm certain this is the case as I saw exactly this kind of failing lookup requests in my DNS server logs.
This is one such tvhmeta invocation:
# tvhmeta --force-refresh --host localhost --user my-username --password my-password --tmdb-key my-tmdb-key --tvdb-key my-tvdb-key --uuid f5be8a96ea70376a0cf298c0ca873b21
This is what the failure logs:
2023-01-06 15:14:17.989 spawn: Traceback (most recent call last): 2023-01-06 15:14:17.989 spawn: File "/usr/lib/python3.9/urllib/request.py", line 1346, in do_open 2023-01-06 15:14:17.990 spawn: h.request(req.get_method(), req.selector, req.data, headers, 2023-01-06 15:14:17.990 spawn: File "/usr/lib/python3.9/http/client.py", line 1285, in request 2023-01-06 15:14:17.991 spawn: self._send_request(method, url, body, headers, encode_chunked) 2023-01-06 15:14:17.991 spawn: File "/usr/lib/python3.9/http/client.py", line 1331, in _send_request 2023-01-06 15:14:17.991 spawn: self.endheaders(body, encode_chunked=encode_chunked) 2023-01-06 15:14:17.991 spawn: File "/usr/lib/python3.9/http/client.py", line 1280, in endheaders 2023-01-06 15:14:17.992 spawn: self._send_output(message_body, encode_chunked=encode_chunked) 2023-01-06 15:14:17.992 spawn: File "/usr/lib/python3.9/http/client.py", line 1040, in _send_output 2023-01-06 15:14:17.992 spawn: self.send(msg) 2023-01-06 15:14:17.992 spawn: File "/usr/lib/python3.9/http/client.py", line 980, in send 2023-01-06 15:14:17.993 spawn: self.connect() 2023-01-06 15:14:17.993 spawn: File "/usr/lib/python3.9/http/client.py", line 946, in connect 2023-01-06 15:14:17.993 spawn: self.sock = self._create_connection( 2023-01-06 15:14:17.993 spawn: File "/usr/lib/python3.9/socket.py", line 823, in create_connection 2023-01-06 15:14:17.994 spawn: for res in getaddrinfo(host, port, 0, SOCK_STREAM): 2023-01-06 15:14:17.994 spawn: File "/usr/lib/python3.9/socket.py", line 954, in getaddrinfo 2023-01-06 15:14:17.994 spawn: for res in _socket.getaddrinfo(host, port, family, type, proto, flags): 2023-01-06 15:14:17.994 spawn: socket.gaierror: [Errno -3] Try again 2023-01-06 15:14:17.994 spawn: During handling of the above exception, another exception occurred: 2023-01-06 15:14:17.994 spawn: Traceback (most recent call last): 2023-01-06 15:14:17.994 spawn: File "/usr/bin/tvhmeta", line 458, in 2023-01-06 15:14:17.994 spawn: process(sys.argv[1:]) 2023-01-06 15:14:17.994 spawn: File "/usr/bin/tvhmeta", line 453, in process 2023-01-06 15:14:17.994 spawn: tvhmeta.fetch_and_persist_artwork(opts.uuid, opts.force_refresh, opts.modules_movie, opts.modules_tv) 2023-01-06 15:14:17.994 spawn: File "/usr/bin/tvhmeta", line 225, in fetch_and_persist_artwork 2023-01-06 15:14:17.995 spawn: recjson = self.request("api/idnode/load", data) 2023-01-06 15:14:17.995 spawn: File "/usr/bin/tvhmeta", line 150, in request 2023-01-06 15:14:17.995 spawn: req = urlopen(full_url, data=bytearray(data, 'utf-8')) 2023-01-06 15:14:17.995 spawn: File "/usr/lib/python3.9/urllib/request.py", line 214, in urlopen 2023-01-06 15:14:17.995 spawn: return opener.open(url, data, timeout) 2023-01-06 15:14:17.995 spawn: File "/usr/lib/python3.9/urllib/request.py", line 517, in open 2023-01-06 15:14:17.995 spawn: response = self._open(req, data) 2023-01-06 15:14:17.995 spawn: File "/usr/lib/python3.9/urllib/request.py", line 534, in _open 2023-01-06 15:14:17.996 spawn: result = self._call_chain(self.handle_open, protocol, protocol + 2023-01-06 15:14:17.996 spawn: File "/usr/lib/python3.9/urllib/request.py", line 494, in _call_chain 2023-01-06 15:14:17.996 spawn: result = func(*args) 2023-01-06 15:14:17.996 spawn: File "/usr/lib/python3.9/urllib/request.py", line 1375, in http_open 2023-01-06 15:14:17.996 spawn: return self.do_open(http.client.HTTPConnection, req) 2023-01-06 15:14:17.996 spawn: File "/usr/lib/python3.9/urllib/request.py", line 1349, in do_open 2023-01-06 15:14:17.997 spawn: raise URLError(err) 2023-01-06 15:14:17.997 spawn: urllib.error.URLError: 2023-01-06 15:15:00.161 spawn: Done
Not a python expert but seems likely due to the migration to python 3. I'm opening this Issue to reference in a PR I'm preparing with a fix.
References:History
Updated by James Bevan over 1 year ago
Have opened PR https://github.com/tvheadend/tvheadend/pull/1519.
Meanwhile I'm unable to sign the Contributor License Agreement, as the link goes to a page saying "Welcome to RunCloud/This is your new Web Application./Please delete this file (index.html) before uploading your own files." Any pointers?
Thanks