超过最大重试次数(由 ProxyError('Cannot connect to proxy.', OSError('Tunnel connection failed: 403 Forbidden')) 引起)
Max retries exceeded (Caused by ProxyError('Cannot connect to proxy.', OSError('Tunnel connection failed: 403 Forbidden')))
我收到一个错误 max retries exceeded and 403 forbidden
但是当我 运行 服务器在本地主机上时它工作得很好。我在 django 模板中显示来自 API 的数据我也尝试关闭验证并保持活动会话但没有任何有趣的事情发生我得到同样的错误
我的代码:
def index(request):
try:
url = "https://www.hetzner.com/a_hz_serverboerse/live_data.json"
s = requests.session()
s.keep_alive = False
r = requests.post(url, verify=False, timeout=5)
data = response.json()['server']
p = Paginator(data, 20)
pn = request.GET.get('page')
page_obj = p.get_page(pn)
context = {
'data': data,
'page_obj': page_obj
}
return render(request, 'index.html', context)
except requests.exceptions.ConnectionError as e:
return HttpResponse({e})
那么您正在使用的服务器没有传出互联网连接,或者您需要在代码中配置代理才能访问互联网,这是基础设施问题,而不是软件开发问题问题,因此您需要咨询管理员 and/or 提供商支持。
我收到一个错误 max retries exceeded and 403 forbidden
但是当我 运行 服务器在本地主机上时它工作得很好。我在 django 模板中显示来自 API 的数据我也尝试关闭验证并保持活动会话但没有任何有趣的事情发生我得到同样的错误
我的代码:
def index(request):
try:
url = "https://www.hetzner.com/a_hz_serverboerse/live_data.json"
s = requests.session()
s.keep_alive = False
r = requests.post(url, verify=False, timeout=5)
data = response.json()['server']
p = Paginator(data, 20)
pn = request.GET.get('page')
page_obj = p.get_page(pn)
context = {
'data': data,
'page_obj': page_obj
}
return render(request, 'index.html', context)
except requests.exceptions.ConnectionError as e:
return HttpResponse({e})
那么您正在使用的服务器没有传出互联网连接,或者您需要在代码中配置代理才能访问互联网,这是基础设施问题,而不是软件开发问题问题,因此您需要咨询管理员 and/or 提供商支持。