我一直试图解析一个网站,当使用urllib2.urlopen我一直在收到错误

时间:2016-12-08 07:31:24

标签: python-2.7 python-requests urllib2 urllib urlopen

任何人都可以解释我通过python登录这个链接(ftpservice.acesphere.com)

2 个答案:

答案 0 :(得分:0)

你得到这个例外:

urllib2.HTTPError: HTTP Error 401: Unauthorized

这意味着该网站正在返回HTTP 401 Unauthorized状态代码。捕获异常或修改您的请求以避免产生此错误。

另请参阅:urllib2 documentation

答案 1 :(得分:0)

您尝试访问的URL需要NTLM身份验证。您可以尝试python-ntlm包:

try
{
    ...
}
catch (const Exception&)
{
    ::MessageBox(NULL, L"Error", L"Error", 0); // <-- Crash happens here,
                                               // BEFORE the message box is displayed
}