# Path: twitch/conf.py
# def backoff_config():
#     initial_backoff = 0.5
#     max_retries = 3
# 
#     config = _get_config()
#     if "General" in config.sections():
#         initial_backoff = float(config["General"]["initial_backoff"])
#         max_retries = int(config["General"]["max_retries"])
# 
#     return initial_backoff, max_retries
# 
# Path: twitch/constants.py
# BASE_URL = "https://api.twitch.tv/kraken/"


import time
import requests
from requests.compat import urljoin
from twitch.conf import backoff_config
from twitch.constants import BASE_URL



DEFAULT_TIMEOUT = 10


class TwitchAPI(object):
    """Twitch API client."""

    def __init__(self, client_id, oauth_token=None):
        """Initialize the API."""
        super(TwitchAPI, self).__init__()
        self._client_id = client_id
        self._oauth_token = oauth_token
        self._initial_backoff, self._max_retries = backoff_config()

    def _get_request_headers(self):
        """Prepare the headers for the requests."""
        headers = {
            "Accept": "application/vnd.twitchtv.v5+json",
            "Client-ID": self._client_id,
        }

        if self._oauth_token:
            headers["Authorization"] = "OAuth {}".format(self._oauth_token)

        return headers


# Path: twitch/conf.py
# def backoff_config():
#     initial_backoff = 0.5
#     max_retries = 3
# 
#     config = _get_config()
#     if "General" in config.sections():
#         initial_backoff = float(config["General"]["initial_backoff"])
#         max_retries = int(config["General"]["max_retries"])
# 
#     return initial_backoff, max_retries
# 
# Path: twitch/constants.py
# BASE_URL = "https://api.twitch.tv/kraken/"


# Path: twitch/api/base.py
import time
import requests
from requests.compat import urljoin
from twitch.conf import backoff_config
from twitch.constants import BASE_URL




DEFAULT_TIMEOUT = 10


class TwitchAPI(object):
    """Twitch API client."""

    def __init__(self, client_id, oauth_token=None):
        """Initialize the API."""
        super(TwitchAPI, self).__init__()
        self._client_id = client_id
        self._oauth_token = oauth_token
        self._initial_backoff, self._max_retries = backoff_config()

    def _get_request_headers(self):
        """Prepare the headers for the requests."""
        headers = {
            "Accept": "application/vnd.twitchtv.v5+json",
            "Client-ID": self._client_id,
        }

        if self._oauth_token:
            headers["Authorization"] = "OAuth {}".format(self._oauth_token)

        return headers


    def _request_get(self, path, params=None, json=True, url=BASE_URL):