<commit_before>import json
import logging
import websocket
import requests
import time
from threading import Thread, Lock

import slacksocket.errors as errors
from .config import slackurl, event_types
from .models import SlackEvent, SlackMsg

log = logging.getLogger('slacksocket')


class SlackClient(requests.Session):
    """
    """
    def __init__(self, token):
        super(SlackClient, self).__init__()
        self.token = token
        self._attempts = 0

    def get_json(self, url, max_attempts=3):
        res = self._get(url)

        try:
            res.raise_for_status()
        except requests.exceptions.HTTPError as e:
            raise errors.SlackSocketAPIError(e)

        rj = res.json()

        if rj['ok']:
            self._attempts = 0
            return rj
<commit_msg>add docstring<commit_after>import json
import logging
import websocket
import requests
import time
from threading import Thread, Lock

import slacksocket.errors as errors
from .config import slackurl, event_types
from .models import SlackEvent, SlackMsg

log = logging.getLogger('slacksocket')


class SlackClient(requests.Session):
    """
    A very small client for connecting to the Slack web API
    """
    def __init__(self, token):
        super(SlackClient, self).__init__()
        self.token = token
        self._attempts = 0

    def get_json(self, url, max_attempts=3):
        res = self._get(url)

        try:
            res.raise_for_status()
        except requests.exceptions.HTTPError as e:
            raise errors.SlackSocketAPIError(e)

        rj = res.json()

        if rj['ok']:
            self._attempts = 0
            return rj

{'fraction_non_alphanumeric': 0.0842358604091456, 'fraction_numerical': 0.0036101083032490976, 'mean_word_length': 2.591792656587473, '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': '1641072', 'n_tokens_mistral': 505, 'n_tokens_neox': 486, 'n_words': 140}