HTTPError:访问内部网站时发生未授权错误

时间:2019-04-29 21:35:45

标签: python-3.x csv unauthorized

我正在尝试下载具有以下网址的CSV文件(出于安全性考虑已更改)

import wget
url = 'http://air.abcd.com/sys_re&CSV'
wget.download(url, 'C:/Users/dbhadra/Desktop/test.csv') 

这将提供以下回溯

Traceback (most recent call last):

  File "<ipython-input-55-db7d4f4363bc>", line 1, in <module>
    wget.download(url, 'C:/Users/dbhadra/Desktop/test.csv')

  File "C:\Users\dbhadra\AppData\Local\Continuum\anaconda3\lib\site-packages\wget.py", line 526, in download
    (tmpfile, headers) = ulib.urlretrieve(binurl, tmpfile, callback)

  File "C:\Users\dbhadra\AppData\Local\Continuum\anaconda3\lib\urllib\request.py", line 247, in urlretrieve
    with contextlib.closing(urlopen(url, data)) as fp:

  File "C:\Users\dbhadra\AppData\Local\Continuum\anaconda3\lib\urllib\request.py", line 222, in urlopen
    return opener.open(url, data, timeout)

  File "C:\Users\dbhadra\AppData\Local\Continuum\anaconda3\lib\urllib\request.py", line 531, in open
    response = meth(req, response)

  File "C:\Users\dbhadra\AppData\Local\Continuum\anaconda3\lib\urllib\request.py", line 641, in http_response
    'http', request, response, code, msg, hdrs)

  File "C:\Users\dbhadra\AppData\Local\Continuum\anaconda3\lib\urllib\request.py", line 563, in error
    result = self._call_chain(*args)

  File "C:\Users\dbhadra\AppData\Local\Continuum\anaconda3\lib\urllib\request.py", line 503, in _call_chain
    result = func(*args)

  File "C:\Users\dbhadra\AppData\Local\Continuum\anaconda3\lib\urllib\request.py", line 755, in http_error_302
    return self.parent.open(new, timeout=req.timeout)

  File "C:\Users\dbhadra\AppData\Local\Continuum\anaconda3\lib\urllib\request.py", line 531, in open
    response = meth(req, response)

  File "C:\Users\dbhadra\AppData\Local\Continuum\anaconda3\lib\urllib\request.py", line 641, in http_response
    'http', request, response, code, msg, hdrs)

  File "C:\Users\dbhadra\AppData\Local\Continuum\anaconda3\lib\urllib\request.py", line 569, in error
    return self._call_chain(*args)

  File "C:\Users\dbhadra\AppData\Local\Continuum\anaconda3\lib\urllib\request.py", line 503, in _call_chain
    result = func(*args)

  File "C:\Users\dbhadra\AppData\Local\Continuum\anaconda3\lib\urllib\request.py", line 649, in http_error_default
    raise HTTPError(req.full_url, code, msg, hdrs, fp)

HTTPError: Unauthorized

我查看了在线问题,但似乎没有反映出这种情况。我需要在某些命令中输入帐户的用户名/密码吗?

0 个答案:

没有答案