<commit_before>"""
Base client to extend to create clients for endpoints of the GiantBomb API
"""
from collections import namedtuple

import pkg_resources
import requests

import pybomb.exceptions
import pybomb.response


ResponseParam = namedtuple('ResponseParam', ('is_filter', 'is_sort'))


class BaseClient(object):
    """
    Base class for API resource clients
    """
    URI_BASE = 'http://www.giantbomb.com/api/'
    RESPONSE_FORMAT_JSON = 'json'
    RESPONSE_FORMAT_XML = 'xml'
    RESPONSE_FIELD_MAP = None
    RESPONSE_STATUS_OK = 1

    RESOURCE_NAME = None

    SORT_ORDER_ASCENDING = 'asc'
    SORT_ORDER_DESCENDING = 'desc'

    def __init__(self, api_key, default_format=RESPONSE_FORMAT_JSON):
        """
        :param api_key: string
        :param default_format: string
        """
        self._api_key = api_key
        self._default_format = default_format
        self._headers = {'User-Agent': 'Pybomb {}'.format(
            pkg_resources.require("pybomb")[0].version
        )}

    @property
    def api_key(self):
        """
        Giant Bomb API key

        :return: string<commit_msg>Add format index, for 2.6<commit_after>"""
Base client to extend to create clients for endpoints of the GiantBomb API
"""
from collections import namedtuple

import pkg_resources
import requests

import pybomb.exceptions
import pybomb.response


ResponseParam = namedtuple('ResponseParam', ('is_filter', 'is_sort'))


class BaseClient(object):
    """
    Base class for API resource clients
    """
    URI_BASE = 'http://www.giantbomb.com/api/'
    RESPONSE_FORMAT_JSON = 'json'
    RESPONSE_FORMAT_XML = 'xml'
    RESPONSE_FIELD_MAP = None
    RESPONSE_STATUS_OK = 1

    RESOURCE_NAME = None

    SORT_ORDER_ASCENDING = 'asc'
    SORT_ORDER_DESCENDING = 'desc'

    def __init__(self, api_key, default_format=RESPONSE_FORMAT_JSON):
        """
        :param api_key: string
        :param default_format: string
        """
        self._api_key = api_key
        self._default_format = default_format
        self._headers = {'User-Agent': 'Pybomb {0}'.format(
            pkg_resources.require("pybomb")[0].version
        )}

    @property
    def api_key(self):
        """
        Giant Bomb API key

        :return: string
{'fraction_non_alphanumeric': 0.09844789356984479, 'fraction_numerical': 0.0031042128603104213, 'mean_word_length': 2.957894736842105, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 2}, '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': '6061241', 'n_tokens_mistral': 729, 'n_tokens_neox': 703, 'n_words': 167}