可以通过邮递员连接,但不能通过python脚本连接

时间:2019-10-24 10:41:32

标签: python api http python-requests postman

我正在帮助我的客户解决问题。他尝试调用我的API,但未成功。

情况:

  • 我的API可通过邮递员和浏览器(swagger)访问。可以。
  • 在同一台计算机上,通过python脚本,我无法访问API

错误:

  

由NewCOnnectionError('
  无法建立新的连接:[Errno 11001] getaddrinfo失败')

如果我尝试一个非常简单的脚本

import requests
r = requests.get('http://google.com')

我遇到同样的错误。

我认为防火墙/代理存在一些问题,但是为什么邮递员可以工作? 我可以在哪个方向指导客户解决问题?

我也尝试了ping,但它也不起作用:

$ ping www.google.com

Ping request could not found host www.google.com. Pleas check the name and try again. 

0 个答案:

没有答案
相关问题