Hanlp_restful无法访问服务器了

今天早晨在使用hanlp时,发现hanlp_restful无法访问服务器了,所有的报错信息如下:

>>> from hanlp_restful import HanLPClient
>>> HanLP = HanLPClient('https://www.hanlp.com/api', auth=None, language='zh')
>>> HanLP(['2021年HanLPv2.1为生产环境带来次世代最先进的多语种NLP技术。', '阿婆主来到北京立方庭参观自然语义科技公司。'])
Traceback (most recent call last):
  File "/root/miniconda3/lib/python3.8/site-packages/urllib3/connection.py", line 159, in _new_conn
    conn = connection.create_connection(
  File "/root/miniconda3/lib/python3.8/site-packages/urllib3/util/connection.py", line 84, in create_connection
    raise err
  File "/root/miniconda3/lib/python3.8/site-packages/urllib3/util/connection.py", line 74, in create_connection
    sock.connect(sa)
ConnectionRefusedError: [Errno 111] Connection refused

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/root/miniconda3/lib/python3.8/site-packages/urllib3/connectionpool.py", line 670, in urlopen
    httplib_response = self._make_request(
  File "/root/miniconda3/lib/python3.8/site-packages/urllib3/connectionpool.py", line 381, in _make_request
    self._validate_conn(conn)
  File "/root/miniconda3/lib/python3.8/site-packages/urllib3/connectionpool.py", line 978, in _validate_conn
    conn.connect()
  File "/root/miniconda3/lib/python3.8/site-packages/urllib3/connection.py", line 309, in connect
    conn = self._new_conn()
  File "/root/miniconda3/lib/python3.8/site-packages/urllib3/connection.py", line 171, in _new_conn
    raise NewConnectionError(
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPSConnection object at 0x7fe15cc4c460>: Failed to establish a new connection: [Errno 111] Connection refused

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/root/miniconda3/lib/python3.8/site-packages/requests/adapters.py", line 439, in send
    resp = conn.urlopen(
  File "/root/miniconda3/lib/python3.8/site-packages/urllib3/connectionpool.py", line 726, in urlopen
    retries = retries.increment(
  File "/root/miniconda3/lib/python3.8/site-packages/urllib3/util/retry.py", line 446, in increment
    raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='www.hanlp.com', port=443): Max retries exceeded with url: /api/parse (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7fe15cc4c460>: Failed to establish a new connection: [Errno 111] Connection refused'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/root/miniconda3/lib/python3.8/site-packages/hanlp_restful/__init__.py", line 128, in __call__
    return self.parse(text, tokens, tasks, skip_tasks)
  File "/root/miniconda3/lib/python3.8/site-packages/hanlp_restful/__init__.py", line 86, in parse
    response = self._send_post_json(self._url + '/parse', {
  File "/root/miniconda3/lib/python3.8/site-packages/hanlp_restful/__init__.py", line 152, in _send_post_json
    return json.loads(_post(url, form, headers, self._timeout))
  File "/root/miniconda3/lib/python3.8/site-packages/hanlp_restful/__init__.py", line 17, in _post
    response = requests.post(url, json=form, headers=headers, timeout=timeout)
  File "/root/miniconda3/lib/python3.8/site-packages/requests/api.py", line 119, in post
    return request('post', url, data=data, json=json, **kwargs)
  File "/root/miniconda3/lib/python3.8/site-packages/requests/api.py", line 61, in request
    return session.request(method=method, url=url, **kwargs)
  File "/root/miniconda3/lib/python3.8/site-packages/requests/sessions.py", line 530, in request
    resp = self.send(prep, **send_kwargs)
  File "/root/miniconda3/lib/python3.8/site-packages/requests/sessions.py", line 643, in send
    r = adapter.send(request, **kwargs)
  File "/root/miniconda3/lib/python3.8/site-packages/requests/adapters.py", line 516, in send
    raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='www.hanlp.com', port=443): Max retries exceeded with url: /api/parse (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7fe15cc4c460>: Failed to establish a new connection: [Errno 111] Connection refused'))

换上我申请的auth,依然是这个问题。这是服务器挂了吗?

服务器https证书过期了,请暂时使用备用域名:https://hanlp.hankcs.com/api

好的。

大概什么时候能恢复呢?

已经恢复了,欢迎使用:https://www.hanlp.com/api/docs

:ok_hand: :smile: