<commit_before>import sys
import requests

class Driver:

    def get_entry(self, doi):
        (url, headers) = self.get_api_url(doi)

        r = requests.get(url, headers=headers)
        r.encoding = "utf-8"

        if r.status_code == 200:
            pass
        elif r.status_code == 404:
            sys.exit("Unknown doi key.")
        else:
            sys.exit("Unhandled http response code: {}".format(r.status_code))

        entry = r.text.strip()

        return entry


class DXDoi(Driver):
    # This website allows information about a paper to be retrieved by accessing
    # http://dx.doi.org/DOI

    def __init__(self):
        self.url = "http://dx.doi.org/"

    def get_api_url(self, doi):
        url = self.url + doi
        headers = {'Accept': 'text/bibliography; style=bibtex'}

        return (url, headers)

class CrossRef(Driver):

    def __init__():
        pass

    def get_api_url(self, doi):
        raise NotImplementedError('Cannot currently use CrossRef to retrieve entries')<commit_msg>Fix the dx.doi.org driver<commit_after>import sys
import requests

class Driver:

    def get_entry(self, doi):
        (url, headers) = self.get_api_url(doi)

        r = requests.get(url, headers=headers)
        r.encoding = "utf-8"

        if r.status_code == 200:
            pass
        elif r.status_code == 404:
            sys.exit("Unknown doi key.")
        else:
            sys.exit("Unhandled http response code: {}".format(r.status_code))

        entry = r.text.strip()

        return entry


class DXDoi(Driver):
    # This website allows information about a paper to be retrieved by accessing
    # http://dx.doi.org/DOI

    def __init__(self):
        self.url = "http://dx.doi.org/"

    def get_api_url(self, doi):
        url = self.url + doi
        headers = {'Accept': 'application/x-bibtex; charset=utf-8'}

        return (url, headers)

class CrossRef(Driver):

    def __init__():
        pass

    def get_api_url(self, doi):
        raise NotImplementedError('Cannot currently use CrossRef to retrieve entries')
{'fraction_non_alphanumeric': 0.11464354527938343, 'fraction_numerical': 0.0072254335260115606, 'mean_word_length': 2.286392405063291, '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': '3551063', 'n_tokens_mistral': 680, 'n_tokens_neox': 617, 'n_words': 172}