<commit_before>import os
from boto import s3
from boto.s3.key import Key
from boto.s3.connection import OrdinaryCallingFormat
import requests
import uuid


# http://stackoverflow.com/a/42493144
def upload_url_to_s3(image_url):
    image_res = requests.get(image_url, stream=True)
    image = image_res.raw
    image_data = image.read()

    fname = str(uuid.uuid4())

    conn = s3.connect_to_region('us-east-1',
                                aws_access_key_id = os.environ['AWS_ACCESS_KEY_ID_DIVERSEUI'],
                                aws_secret_access_key = os.environ['AWS_SECRET_KEY_DIVERSEUI'],
                                is_secure = True,
                                calling_format = OrdinaryCallingFormat(),
                                )
    bucket = conn.get_bucket('static.diverseui.com')

    k = Key(bucket, fname)
    k.set_contents_from_string(image_data)
    k.make_public()

    return 'https://static.diverseui.com/{}'.format(fname)
<commit_msg>Maybe this will fix boto<commit_after>import os
from boto import connect_s3
from boto.s3.key import Key
from boto.s3.connection import OrdinaryCallingFormat
import requests
import uuid


# http://stackoverflow.com/a/42493144
def upload_url_to_s3(image_url):
    image_res = requests.get(image_url, stream=True)
    image = image_res.raw
    image_data = image.read()

    fname = str(uuid.uuid4())

    conn = connect_s3(
        os.environ['AWS_ACCESS_KEY_ID_DIVERSEUI'],
        os.environ['AWS_SECRET_KEY_DIVERSEUI'],
        is_secure = True,
        calling_format = OrdinaryCallingFormat(),
    )
    bucket = conn.get_bucket('static.diverseui.com')

    k = Key(bucket, fname)
    k.set_contents_from_string(image_data)
    k.make_public()

    return 'https://static.diverseui.com/{}'.format(fname)

{'fraction_non_alphanumeric': 0.10196078431372549, 'fraction_numerical': 0.016246498599439777, 'mean_word_length': 2.8162393162393164, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3150363', 'n_tokens_mistral': 614, 'n_tokens_neox': 596, 'n_words': 100}