I'm getting an error max retries exceeded and 403 forbidden
but when I run server on localhost it's working perfectly fine. I'm showing data from an API in django template I also tried to turn off validation and keep alive sessions but nothing intersting happened I'm getting same error
my code:
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})
CodePudding user response:
Then the server you are using doesn't have an outgoing Internet connection or there is a proxy that you need to configure in your code so you can reach the internet, this is an infrastructure issue and not and a software development issue, so you need to check with Admin and/or provider support.