我有一个Flask Restful服务,可以通过以下方式访问它:
st = "http://0.0.0.0:3000/sentence={}"
url_str = st.format(text).replace('\n', '')
req = requests.get(url_str).content
bs = json.loads(BeautifulSoup(req, features="html.parser").string)
我可以在自己的计算机上访问它。
但是,如果我在计算机上启动VPN服务,然后又想启动此Restful,则它总是会失败:
Traceback (most recent call last):
File "/my-envs/dialog-envs/lib/python3.7/site-packages/urllib3/connectionpool.py", line 600, in urlopen
chunked=chunked)
File "/my-envs/dialog-envs/lib/python3.7/site-packages/urllib3/connectionpool.py", line 384, in _make_request
six.raise_from(e, None)
File "<string>", line 2, in raise_from
File "/my-envs/dialog-envs/lib/python3.7/site-packages/urllib3/connectionpool.py", line 380, in _make_request
httplib_response = conn.getresponse()
File "/usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/lib/python3.7/http/client.py", line 1321, in getresponse
response.begin()
File "/usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/lib/python3.7/http/client.py", line 296, in begin
version, status, reason = self._read_status()
File "/usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/lib/python3.7/http/client.py", line 257, in _read_status
line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
File "/usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/lib/python3.7/socket.py", line 589, in readinto
return self._sock.recv_into(b)
ConnectionResetError: [Errno 54] Connection reset by peer
During handling of the above exception, another exception occurred:
为什么我必须关闭“ VPN”才能运行静态?