简体   繁体   English

Python urllib.request在Azure笔记本中引发403

[英]Python urllib.request Throws 403 in Azure Notebooks

Trying to acquire the TensorFlow Object Detection API models in a Azure Notebooks but everything I try gives 403 Forbidden. 尝试在Azure笔记本中获取TensorFlow对象检测API模型,但我尝试的所有操作都给出了403 Forbidden。 No problems retrieving the files locally or on AWS. 在本地或在AWS上检索文件没有问题。

import six.moves.urllib as urllib
url = 'http://download.tensorflow.org/models/object_detection/rfcn_resnet101_coco_11_06_2017.tar.gz'
opener = urllib.request.URLopener()
opener.retrieve(url)

I tried adding User-Agent data to the header etc but that failed. 我尝试将User-Agent数据添加到标头等中,但是失败了。 Tried using wget and that gave a 403 also. 使用wget尝试过,结果也为403。 I think the notebooks run in a docker container so maybe some issue there. 我认为笔记本在docker容器中运行,因此可能存在一些问题。 Any insight or work-arounds would be much appreciated. 任何见解或变通办法将不胜感激。

Azure Notebooks intentionally restricts access to external URLs. Azure笔记本有意限制对外部URL的访问。 This is most likely to prevent people from using the Notebooks service to perform denial of service attacks to other sites. 这最有可能阻止人们使用Notebooks服务对其他站点进行拒绝服务攻击。

https://blogs.technet.microsoft.com/machinelearning/2016/03/30/jupyter-notebooks-with-r-in-azure-ml-studio-2/ https://blogs.technet.microsoft.com/machinelearning/2016/03/30/jupyter-notebooks-with-r-in-azure-ml-studio-2/

Access to external internet sites is restricted. 限制访问外部互联网站点。 However, we have white listed a number of important URLs: 但是,我们在白名单中列出了许多重要的URL:

  • All CRAN mirrors are on the white list, so you should be able to install packages using your favorite CRAN mirror. 所有CRAN镜像都在白名单上,因此您应该能够使用自己喜欢的CRAN镜像来安装软件包。
  • Github is also white listed, meaning you can use devtools::install_github() to install packages that are not on CRAN, or get the development version of a package. Github也在白名单上,这意味着您可以使用devtools :: install_github()安装不在CRAN上的软件包,或获取软件包的开发版本。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM