import json
import requests


def check_aws(admin_api_key, env, cc_account_id):
    """
    Checks if an account is an AWS Account with get_account API call
    """

    api_url = env + "/api/account.json/get_account"

    get_account_info = json.dumps({"account_id": cc_account_id})

    r7 = requests.post(api_url, headers = {"Content-Type": "application/json", "access_key": admin_api_key}, data = get_account_info)

    # checks for AWS (works for mav and non-mav)
    if "Provider" in r7.json():
        if r7.json()["Provider"] == "Amazon Web Services":
            return True
    return False