<commit_before>"""
Wallabag API accesses.
"""
from enum import Enum
import requests
import conf


class Error(Enum):
    undefined = -1
    ok = 0


class ApiMethod(Enum):
    version = "/api/version"


def __getApiUrl(api_method):
    if api_method in ApiMethod:
        return conf.get_config('serverurl') + api_method.value
    return None


def version():
    url = __getApiUrl(ApiMethod.version)
    response = requests.get(url)

    return response.status_code, Error.ok, response.text<commit_msg>Implemented class for handling api responses<commit_after>"""
Wallabag API accesses.
"""
from enum import Enum
import requests
import conf


class Error(Enum):
    undefined = -1
    ok = 0


class ApiMethod(Enum):
    version = "/api/version"


class Response:
    http_code = 0
    error = Error.undefined
    response = ""

    def __init__(self, api_response):
        self.http_code, self.error, self.response = api_response


def __getApiUrl(api_method):
    if api_method in ApiMethod:
        return conf.get_config('serverurl') + api_method.value
    return None


def version():
    url = __getApiUrl(ApiMethod.version)
    response = requests.get(url)

    return response.status_code, Error.ok, response.text
{'fraction_non_alphanumeric': 0.0973017170891251, 'fraction_numerical': 0.004088307440719542, 'mean_word_length': 3.4671532846715327, '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': '180248', 'n_tokens_mistral': 385, 'n_tokens_neox': 373, 'n_words': 104}