Forums

Unable to connect to API using PA

Hi, I have been coding my app on desktop which works fine, uploaded to PA and unable to connect to API. In this instance i'm connecting to Get REsponse. This is the error. ProxyError at /postcode-signup HTTPSConnectionPool(host='api.getresponse.com', port=443): Max retries exceeded with url: /v3/contacts (Caused by ProxyError('Cannot connect to proxy.', OSError('Tunnel connection failed: 403 Forbidden')))

Has anyone come across this, and any subsequent fixes.

This code to post lead:

def post_lead(self):

    url = "https://api.getresponse.com/v3/contacts"

    payload = '{ "name": "'+ self.first_name +'","email": "'+ self.email +'","campaign": { "campaignId": "XXX" },"ipAddress": "X","customFieldValues": [ { "customFieldId": "XXXX", "value": [ "'+ str(self.id) +'" ] } ] }'


    headers = {
        'X-Auth-Token': "api-key XXXXXXXXXXXXXXXXXXXXX",
        'Content-Type': "application/json",
        'cache-control': "no-cache",
}

And code to create account:

def create_account(request):
if request.method == "POST":
    if Account.objects.filter(email=request.POST['email']).exists():
        return HttpResponse("dupe")
    else:
       ip = get_client_ip(request)
       dob = datetime.strptime(request.POST['birth_day'] + request.POST['birth_month'] + request.POST['birth_year'], "%d%m%Y").date()
       cid = ""
       if "cid" in request.GET:
            cid = request.GET["cid"]
    account = Account.objects.create(email=request.POST['email'], first_name=request.POST['first_name'],)
    return render HttpResponse("window.location.href='/lp/?id=check-email&cid=" + cid + "'")

Thanks

Hi,

I have just checked out your whitelist and it does not include api.getresponse.com.

So, i'm assuming that is the problem here.

Please do advise when this can be added to the whitelist. Thanks

Send us a link to the API documentation and we'll consider it for the whitelist.

https://apidocs.getresponse.com/v3

No problem. I've added that to the whitelist.

Thank you!