Файл "/usr/lib/python3.6/encodings/idna.py", строка 165, в закодированном повышении UnicodeError ("метка пустая или слишком длинная") - PullRequest
0 голосов
/ 19 сентября 2019

мой код прост, отправьте длинный URL-запрос, затем получите эту проблему -.-

Это работает на AWS.

'' 'Это полное сообщение:

Traceback (most recent call last):
  File "/usr/lib/python3.6/encodings/idna.py", line 165, in encode
    raise UnicodeError("label empty or too long")
UnicodeError: label empty or too long

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

Traceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/gevent/threadpool.py", line 281, in _worker
    value = func(*args, **kwargs)
UnicodeError: encoding with 'idna' codec failed (UnicodeError: label empty or too long)
2019-09-19T07:33:57Z (<ThreadPool at 0x7fef0a529160 0/6/10 hub=<Hub at 0x7fef0bbbb6d8 thread_ident=0x140664755951360>>, <built-in function getaddrinfo>) failed with UnicodeError

'' '

' '' основной код, как этот '' '

def send_request(self, url):
        try:
            response = requests.request('get', url)
            print('[send_request]', interface)
            if response:
                return self.handle_response(response)
        except Exception as e:
            logging.debug(f'[ send_request ] {e}')
...