requests.exceptions.MissingSchema:包含ArtifactoryPath的URL无效

时间:2018-03-13 22:47:48

标签: python artifactory

我正在尝试使用神器python模块从artifactory部署和下载文件,并且它不断抛出错误。

从模块页面(https://pypi.python.org/pypi/artifactory/0.1.17),它给出了以下示例:

from artifactory import ArtifactoryPath
path = ArtifactoryPath(
   "http://repo.jfrog.org/artifactory/distributions/org/apache/tomcat/apache-
tomcat-7.0.11.tar.gz")

with path.open() as fd:
    with open("tomcat.tar.gz", "wb") as out:
        out.write(fd.read())

当我尝试使用回购邮件时,我正在使用以下代码:

from artifactory import ArtifactoryPath
path = ArtifactoryPath("https://artifactory.path.to.repo/file.tar.gz")

with path.open() as fd:
    with open("test_artifact.tar.gz", "wb") as fh:
        fh.write(fd.read())

我收到以下错误:

requests.exceptions.MissingSchema: Invalid URL 'https:/artifactory.path.to.repo/file.tar.gz': No schema supplied. Perhaps you meant http://artifactory.path.to.repo/file.tar.gz?

我不明白为什么它一直在剥离' /'来自' https://'。我甚至尝试过添加" http://"在网址前面看它会做什么,但它只是给出了:

requests.exceptions.MissingSchema: Invalid URL 'http:/https:/artifactory.path.to.repo/file.tar.gz': No schema supplied. Perhaps you meant http://http:/https:/artifactory.path.to.repo/file.tar.gz?

有没有人在使用神器模块之前看到/处理过这个错误?

编辑:我使用的是Windows 10和Python3.5

0 个答案:

没有答案