<commit_before>import json
import requests

default_onfido_url = "https://api.onfido.com/v1/"


class OnfidoApiRequestor(object):

    def __init__(self, api_key, onfido_url=default_onfido_url):
        self.api_key = api_key
        self.onfido_url = onfido_url

    def build_url(self, path):
        return self.onfido_url + path

    def headers(self, including_file=False):
        headers = {
               "Authorization": "Token token={0}".format(self.api_key)
        }
        
        if including_file:
            headers["Content-Type"] = "application/json"
        
        return headers

    def post(self, url, data, file=None):
        h = self.headers(file is not None)
        response = requests.post(self.build_url(url),
                                 data=data,
                                 headers=h,
                                 files=file)
        return json.loads(response.text)

    def get(self, url, params):
        response = requests.get(self.build_url(url),
                                params=params,
                                headers=self.headers())
        return json.loads(response.text)
<commit_msg>flake8<commit_after>import json
import requests

default_onfido_url = "https://api.onfido.com/v1/"


class OnfidoApiRequestor(object):

    def __init__(self, api_key, onfido_url=default_onfido_url):
        self.api_key = api_key
        self.onfido_url = onfido_url

    def build_url(self, path):
        return self.onfido_url + path

    def headers(self, including_file=False):
        headers = {
           "Authorization": "Token token={0}".format(self.api_key)
        }

        if including_file:
            headers["Content-Type"] = "application/json"

        return headers

    def post(self, url, data, file=None):
        h = self.headers(file is not None)
        response = requests.post(self.build_url(url),
                                 data=data,
                                 headers=h,
                                 files=file)
        return json.loads(response.text)

    def get(self, url, params):
        response = requests.get(self.build_url(url),
                                params=params,
                                headers=self.headers())
        return json.loads(response.text)

{'fraction_non_alphanumeric': 0.09847494553376906, 'fraction_numerical': 0.002178649237472767, 'mean_word_length': 1.7431302270011948, 'pattern_counts': {'":': 2, '<': 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': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7515371', 'n_tokens_mistral': 667, 'n_tokens_neox': 654, 'n_words': 124}