Wget &Python/无用户选项 [英] Wget & Python / No user option

查看:33
本文介绍了Wget &Python/无用户选项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用 python 库 wget:

I use the python library wget:

import wget
wget.download("https://example.com")

它给了我以下错误:

IOError: ('http error', 401, 'Unauthorized', <httplib.HTTPMessage instance at 0x10728c0>)

发生这种情况是因为我应该使用 user & 选项密码以获取文件.

This happens because I should use the option of user & password in order to get the files.

有什么选择吗?如果没有,使用用户和密码从外部存储库下载 python 文件夹的最佳方法是什么?

Is there any option for that? If not, what is the best way to download a folder in python from external repository with user and password?

推荐答案

您可以在 URL it self 中提供用于基本身份验证的用户名密码,请尝试以下代码.

You can give username password for basic authentication in URL it self, try below code.

import wget
wget.download("https://username:password@example.com/")

这篇关于Wget &amp;Python/无用户选项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆