scripts/aws_ecommerce_api.py
def send_confirm_sign_up_request(email, confirm_code, proxy):
    """
    For some reason sending POST request doesnt work
    use aws cli instead
    """
    payload = {"ClientId": client_id, "ConfirmationCode": confirm_code, "Username": email, "ForceAliasCreation": True}
    headers = {
        "Host": "cognito-idp.us-east-1.amazonaws.com",
        "Content-Type": "application/x-amz-json-1.1",
        "Accept": "*/*",
        "Referer": "http://awsamplifyecommerce-20200713180028-hostingbucket-dev.s3-website-us-east-1.amazonaws.com/",
        "X-Amz-Target": "AWSCognitoIdentityProviderService.ConfirmSignUp",
        "X-Amz-User-Agent": "aws-amplify/0.1.x js",
        "Origin": "http://awsamplifyecommerce-20200713180028-hostingbucket-dev.s3-website-us-east-1.amazonaws.com",
        "TE": "Trailers",
        "Connection": "keep-alive",
        "cache-control": "no-cache",
    }
    resp = requests.post(main_url, data=json.dumps(payload), headers=headers, verify=False, proxies={"http": proxy, "https": proxy})
    if resp.status_code != 200:
        print("Confirm SignUp request Failed: status code {0}, due to {1}".format(resp.status_code, resp.content))
        return False

    return True

    # output = subprocess.run(["aws", "cognito-idp", "confirm-sign-up", "--client-id", client_id,
    #                          "--username={0}".format(email), "--confirmation-code", confirm_code, "--user-context-dat={0}".format(proxy)],
    #                         stdout=subprocess.PIPE, stderr=subprocess.PIPE)
    #
    # if output.stderr:
    #     print("Confirm SignUp request Failed due to \n{0}".format(output.stderr))
    #     return False
    #
    # return True

    # output = subprocess.run(["curl", "-X", "POST", "https://cognito-idp.us-east-1.amazonaws.com/", "-H", "Content-Type: application/x-amz-json-1.1",
    #                         "-H", 'cache-control: no-cache', "-H", 'x-amz-target: AWSCognitoIdentityProviderService.ConfirmSignUp',
    #                         "-d", json.dumps(payload), "-x", proxy],
    #                         stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True
    #                         )
    #
    # if output.stderr:
    #     print("Confirm SignUp request Failed due to \n{0}".format(output.stderr))
    #     return False
    #
    # return True

    For some reason sending POST request doesnt work
    use aws cli instead
    
For some reason sending POST request doesnt work
use aws cli instead
For some reason sending POST request doesnt work use aws cli instead
def send_confirm_sign_up_request(email, confirm_code, proxy):
    payload = {"ClientId": client_id, "ConfirmationCode": confirm_code, "Username": email, "ForceAliasCreation": True}
    headers = {
        "Host": "cognito-idp.us-east-1.amazonaws.com",
        "Content-Type": "application/x-amz-json-1.1",
        "Accept": "*/*",
        "Referer": "http://awsamplifyecommerce-20200713180028-hostingbucket-dev.s3-website-us-east-1.amazonaws.com/",
        "X-Amz-Target": "AWSCognitoIdentityProviderService.ConfirmSignUp",
        "X-Amz-User-Agent": "aws-amplify/0.1.x js",
        "Origin": "http://awsamplifyecommerce-20200713180028-hostingbucket-dev.s3-website-us-east-1.amazonaws.com",
        "TE": "Trailers",
        "Connection": "keep-alive",
        "cache-control": "no-cache",
    }
    resp = requests.post(main_url, data=json.dumps(payload), headers=headers, verify=False, proxies={"http": proxy, "https": proxy})
    if resp.status_code != 200:
        print("Confirm SignUp request Failed: status code {0}, due to {1}".format(resp.status_code, resp.content))
        return False
    return True
     if output.stderr:
         print("Confirm SignUp request Failed due to \n{0}".format(output.stderr))
         return False
     return True
     output = subprocess.run(["curl", "-X", "POST", "https://cognito-idp.us-east-1.amazonaws.com/", "-H", "Content-Type: application/x-amz-json-1.1",
                             "-H", 'cache-control: no-cache', "-H", 'x-amz-target: AWSCognitoIdentityProviderService.ConfirmSignUp',
                             "-d", json.dumps(payload), "-x", proxy],
                             stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True
                             )
     if output.stderr:
         print("Confirm SignUp request Failed due to \n{0}".format(output.stderr))
         return False
     return True
def send_confirm_sign_up_request ( email , confirm_code , proxy ) : payload = { "ClientId" : client_id , "ConfirmationCode" : confirm_code , "Username" : email , "ForceAliasCreation" : True } headers = { "Host" : "cognito-idp.us-east-1.amazonaws.com" , "Content-Type" : "application/x-amz-json-1.1" , "Accept" : "*/*" , "Referer" : "http://awsamplifyecommerce-20200713180028-hostingbucket-dev.s3-website-us-east-1.amazonaws.com/" , "X-Amz-Target" : "AWSCognitoIdentityProviderService.ConfirmSignUp" , "X-Amz-User-Agent" : "aws-amplify/0.1.x js" , "Origin" : "http://awsamplifyecommerce-20200713180028-hostingbucket-dev.s3-website-us-east-1.amazonaws.com" , "TE" : "Trailers" , "Connection" : "keep-alive" , "cache-control" : "no-cache" , } resp = requests . post ( main_url , data = json . dumps ( payload ) , headers = headers , verify = False , proxies = { "http" : proxy , "https" : proxy } ) if resp . status_code != 200 : print ( "Confirm SignUp request Failed: status code {0}, due to {1}" . format ( resp . status_code , resp . content ) ) return False return True
For some reason sending POST request doesnt work
use aws cli instead
For some reason sending POST request doesnt work use aws cli instead
"""
    For some reason sending POST request doesnt work
    use aws cli instead
    """ # output = subprocess.run(["aws", "cognito-idp", "confirm-sign-up", "--client-id", client_id, #                          "--username={0}".format(email), "--confirmation-code", confirm_code, "--user-context-dat={0}".format(proxy)], #                         stdout=subprocess.PIPE, stderr=subprocess.PIPE) # # if output.stderr: #     print("Confirm SignUp request Failed due to \n{0}".format(output.stderr)) #     return False # # return True # output = subprocess.run(["curl", "-X", "POST", "https://cognito-idp.us-east-1.amazonaws.com/", "-H", "Content-Type: application/x-amz-json-1.1", #                         "-H", 'cache-control: no-cache', "-H", 'x-amz-target: AWSCognitoIdentityProviderService.ConfirmSignUp', #                         "-d", json.dumps(payload), "-x", proxy], #                         stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True #                         ) # # if output.stderr: #     print("Confirm SignUp request Failed due to \n{0}".format(output.stderr)) #     return False # # return True
email
confirm_code
proxy