Adi*_*ong 11 python python-3.4
我在python3.4上有一个脚本,直到我下载文件的网站决定使用https并且现在我收到错误但我无法弄清楚如何可以检索文件.
我的脚本导入以下库并使用urlretrive获取以前的文件.因为它现在转发到具有302重定向的https.我收到一些错误.
import urllib
import urllib.request
urllib.request.urlretrieve("http://wordpress.org/latest.tar.gz", "/thefile.gz")
Run Code Online (Sandbox Code Playgroud)
我的错误: -
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.4/urllib/request.py", line 178, in urlretrieve
with contextlib.closing(urlopen(url, data)) as fp:
File "/usr/local/lib/python3.4/urllib/request.py", line 153, in urlopen
return opener.open(url, data, timeout)
File "/usr/local/lib/python3.4/urllib/request.py", line 461, in open
response = meth(req, response)
File "/usr/local/lib/python3.4/urllib/request.py", line 571, in http_response
'http', request, response, code, msg, hdrs)
File "/usr/local/lib/python3.4/urllib/request.py", line 493, in error
result = self._call_chain(*args)
File "/usr/local/lib/python3.4/urllib/request.py", line 433, in _call_chain
result = func(*args)
File "/usr/local/lib/python3.4/urllib/request.py", line 676, in http_error_302
return self.parent.open(new, timeout=req.timeout)
File "/usr/local/lib/python3.4/urllib/request.py", line 455, in open
response = self._open(req, data)
File "/usr/local/lib/python3.4/urllib/request.py", line 478, in _open
'unknown_open', req)
File "/usr/local/lib/python3.4/urllib/request.py", line 433, in _call_chain
result = func(*args)
File "/usr/local/lib/python3.4/urllib/request.py", line 1257, in unknown_open
raise URLError('unknown url type: %s' % type)
urllib.error.URLError: <urlopen error unknown url type: https>
Run Code Online (Sandbox Code Playgroud)
Mik*_*maa 20
您的Python安装或操作系统很可能已损坏.
如果使用HTTPS支持编译,Python仅支持HTTPS.但是,这应该是所有理智安装的默认设置.
HTTPS support is only available if the socket module was compiled with SSL support.
Run Code Online (Sandbox Code Playgroud)
https://docs.python.org/3/library/http.client.html
请说明你是如何安装Python的.官方Python发行版可在python.org上获得
| 归档时间: |
|
| 查看次数: |
24222 次 |
| 最近记录: |