<commit_before>class Request:
    GET = 'get'
    POST = 'post'

    def __init__(self, url, type, data=None):
        self.url = url
        self.type = type
        self.data = data


class RequestData:
    def __init__(self, data=None):
        self.data = data

    def for_type(self, type=Request.GET):
        if type is Request.GET:
            return data
<commit_msg>Create Error-classes, Client class and do function for Request<commit_after>import requests
from time import time


class Client:
    def __init__(self):
        pass


class Request:
    GET = 'get'
    POST = 'post'

    def __init__(self, url, type, data=None):
        self.url = url
        self.type = type
        self.data = data

    def do(self):
        try:
            data = ''
            if isinstance(self.data, RequestData):
                data = self.data.for_type(type=self.type)
            self.started = time()
            response = getattr(requests, self.type)(
                url=self.url,
                data=data
            )
            self.finished = time()
            self.status_code = response.status_code
        except AttributeError:
            raise RequestTypeError(type=self.type)

    def get_response_time(self):
        try:
            return self.finished - self.started
        except AttributeError:
            raise RequestTimeError


class RequestData:
    def __init__(self, data=None):
        self.data = data

    def for_type(self, type=Request.GET):
        if type is Request.GET:
            return data


class RequestTypeError(Exception):
    def __init__(self, type):
        self.type = type

    def __str__(self):
        return 'Invalid request type "%s".' % self.type


class RequestTimeError(Exception):
    pass

{'fraction_non_alphanumeric': 0.09137343927355278, 'fraction_numerical': 0.0, 'mean_word_length': 1.9285714285714286, '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': '3261246', 'n_tokens_mistral': 510, 'n_tokens_neox': 489, 'n_words': 137}