import urllib3, sys, boto3 bucket_name = sys.argv[2] url = sys.argv[1] file = url.split('/')[-1:][0] ext = file.split('.')[-1:][0] http = urllib3.PoolManager(cert_reqs=None) r = http.request('GET', url) with open(file, 'wb') as the_file: the_file.write(r.data) s3 = boto3.client('s3') s3.upload_file(file, bucket_name, file, ExtraArgs={'ACL': 'public-read', 'ContentType':'image/'+ext})