def get_s3_ip_by_region()

in resources/code/my-first-enclave/secure-local-channel/server.py [0:0]


def get_s3_ip_by_region(region):
    
    full_query = 'https://ip-ranges.amazonaws.com/ip-ranges.json'
    print("Full URL:",full_query)

    print("URL Open")
    data = urllib.request.urlopen(full_query)

    print("Handle Response")
    
    response = json.loads(data.read())
    ip_ranges = response['prefixes']
    s3_ips = []
    for item in ip_ranges:
        if (item["service"] == "S3") and (item["region"] == region):
            s3_ips.append(item["ip_prefix"])
    return s3_ips