<commit_before>import logging
try:
    from google.appengine.api.urlfetch import fetch as urlfetch_fetch
except ImportError:
    logging.warn("There's no Appengine UrlFetch")
    def urlfetch_fetch(url, deadline=10):
        import httplib
        url = url[len("http://"):]
        conn = httplib.HTTPConnection(url[:url.find("/")])
        conn.request("GET", url[url.find("/"):])
        response = conn.getresponse()
        print response.status, response.reason
        data = response.read()
        return data
    


def get(url):
    response = urlfetch_fetch(url, deadline=10)
    if response.status_code != 200:
        raise IOError
    return response.content
    
def post(url, content):
    return urlfetch_fetch(url, payload=content, method="POST", follow_redirects=True)
    <commit_msg>Fix inconsistencies in http helper<commit_after>import logging
try:
    from google.appengine.api.urlfetch import fetch as urlfetch_fetch
except ImportError:
    logging.warn("There's no Appengine UrlFetch")
    def urlfetch_fetch(url, deadline=10):
        import httplib
        url = url[len("http://"):]
        conn = httplib.HTTPConnection(url[:url.find("/")])
        conn.request("GET", url[url.find("/"):])
        response = conn.getresponse()
        print response.status, response.reason
        data = response.read()
        return data

def get(url):
    response = urlfetch_fetch(url, deadline=10)
    if hasattr(response, 'status_code'):
        if response.status_code != 200:
            raise IOError
        return response.content
    else:
        return response

def post(url, content):
    return urlfetch_fetch(url, payload=content, method="POST", follow_redirects=True)
{'fraction_non_alphanumeric': 0.11685261303581915, 'fraction_numerical': 0.008220786846741044, 'mean_word_length': 3.1159420289855073, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, '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': '5684719', 'n_tokens_mistral': 502, 'n_tokens_neox': 490, 'n_words': 120}