# Path: feedhq/utils.py
# def get_redis_connection():
#     """
#     Helper used for obtain a raw redis client.
#     """
#     from redis_cache.cache import pool
#     client = redis.Redis(**settings.REDIS)
#     client.connection_pool = pool.get_connection_pool(
#         client,
#         parser_class=redis.connection.HiredisParser,
#         connection_pool_class=redis.ConnectionPool,
#         connection_pool_class_kwargs={},
#         **settings.REDIS)
#     return client


import datetime
import requests
from urllib.parse import parse_qs, urlencode, urlsplit, urlunsplit
from django.conf import settings
from django.core.cache import cache
from django.utils import timezone
from rache import job_details, job_key
from requests.exceptions import (ConnectionError, ConnectTimeout,
                                 InvalidSchema, InvalidURL, MissingSchema,
                                 ReadTimeout, TooManyRedirects)
from requests.packages.urllib3.exceptions import LocationValueError
from .. import __version__
from ..utils import get_redis_connection
# -*- coding: utf-8 -*-




USER_AGENT = (
    'FeedHQ/%s (https://github.com/feedhq/feedhq; %%s; https://github.com/'
    'feedhq/feedhq/wiki/fetcher; like FeedFetcher-Google)'
) % __version__
FAVICON_FETCHER = USER_AGENT % 'favicon fetcher'
LINK_CHECKER = USER_AGENT % 'ping'


def is_feed(parsed):
    return hasattr(parsed.feed, 'title')


def epoch_to_utc(value):
    """Converts epoch (in seconds) values to a timezone-aware datetime."""
    return timezone.make_aware(
        datetime.datetime.fromtimestamp(value), timezone.utc)


class JobNotFound(Exception):
    pass


def get_job(name):

# Path: feedhq/utils.py
# def get_redis_connection():
#     """
#     Helper used for obtain a raw redis client.
#     """
#     from redis_cache.cache import pool
#     client = redis.Redis(**settings.REDIS)
#     client.connection_pool = pool.get_connection_pool(
#         client,
#         parser_class=redis.connection.HiredisParser,
#         connection_pool_class=redis.ConnectionPool,
#         connection_pool_class_kwargs={},
#         **settings.REDIS)
#     return client


# Path: feedhq/feeds/utils.py
import datetime
import requests
from urllib.parse import parse_qs, urlencode, urlsplit, urlunsplit
from django.conf import settings
from django.core.cache import cache
from django.utils import timezone
from rache import job_details, job_key
from requests.exceptions import (ConnectionError, ConnectTimeout,
                                 InvalidSchema, InvalidURL, MissingSchema,
                                 ReadTimeout, TooManyRedirects)
from requests.packages.urllib3.exceptions import LocationValueError
from .. import __version__
from ..utils import get_redis_connection

# -*- coding: utf-8 -*-




USER_AGENT = (
    'FeedHQ/%s (https://github.com/feedhq/feedhq; %%s; https://github.com/'
    'feedhq/feedhq/wiki/fetcher; like FeedFetcher-Google)'
) % __version__
FAVICON_FETCHER = USER_AGENT % 'favicon fetcher'
LINK_CHECKER = USER_AGENT % 'ping'


def is_feed(parsed):
    return hasattr(parsed.feed, 'title')


def epoch_to_utc(value):
    """Converts epoch (in seconds) values to a timezone-aware datetime."""
    return timezone.make_aware(
        datetime.datetime.fromtimestamp(value), timezone.utc)


class JobNotFound(Exception):
    pass


def get_job(name):

    redis = get_redis_connection()