OSError('Туннельное соединение не удалось: 403 Forbidden')))

Я пытаюсь инициировать запрос к API (https://theteller.net/documentation#theTeller_Standard), но продолжаю получать эту ошибку. Идея заключается в том, чтобы получить данные пользователя и передать их в мой views.py для отправки запроса на совершение платежа и перенаправления обратно на мой сайт. Вот эта ошибка

ProxyError at /vote/test/robert-yenji/

HTTPSConnectionPool(host='test.theteller.net', port=443): Max retries exceeded with url: /checkout/initiate (Caused by ProxyError('Cannot connect to proxy.', OSError('Tunnel connection failed: 403 Forbidden')))

это мой код

views.py

 def nomination_payView(request, slug):
        if request.method == 'GET':
            model = get_object_or_404(Nomination, slug=slug)
            template_name = 'Payment.html'
            context = {
                'nomination': model
            }
            return render(request, 'Payment.html', context)
        elif request.method == 'POST':
            amount = (str(int(request.POST['amount']) * 0.5) + '0').replace('.', '')
            zeros = '0' * (12 - len(amount))
            amount = zeros + amount
            email = request.POST['email']
            desc = request.POST['desc']

            url = 'https://test.theteller.net/checkout/initiate'
            transaction_id = random.randint(100000000000, 999999999999)
            data = {
                "merchant_id": "TTM-00000740",
                "transaction_id": transaction_id,
                "amount": amount,
                "redirect_url": f"http://127.0.0.1:8000/process-payment/{slug}/{amount}",
                "apiuser": "halotech5d525bfd6ead3",
                "API_Key": "ZDQ2OGEyZDNjN2YzMDY5ZDVkY2MyM2U5YTRiMGI0N2Q=",
                "email": email,  # you would need to change this to the actual users email
                "desc": desc,  # this as well...

            }
            encoded = base64.b64encode(
                b'halotech5d525bfd6ead3:ZDQ2OGEyZDNjN2YzMDY5ZDVkY2MyM2U5YTRiMGI0N2Q=')  # change this as well
            headers = {
                'Content-Type': 'application/json',
                'Authorization': f'Basic {encoded.decode("utf-8")}',
                'Cache-Control': 'no-cache'
            }
            res = requests.post(url, data=json.dumps(data), headers=headers).json()
            print(res['checkout_url'])
            return redirect(res["checkout_url"])```


[This is the error i get ][1]



  [1]: https://i.stack.imgur.com/KA3xZ.png
Вернуться на верх