# Buggy code
def search(self, search_strings, age=0, ep_obj=None):  # pylint: disable=too-many-locals, too-many-branches
    """
    Search a provider and parse the results

    :param search_strings: A dict with mode (key) and the search value (value)
    :param age: Not used
    :param ep_obj: Not used
    :returns: A list of search results (structure)
    """
    results = []
    if not self.login():
        return results

    for mode in search_strings:
        logger.log("Search mode: {0}".format(mode), logger.DEBUG)

        for search_string in search_strings[mode]:
            if mode != "RSS":
                logger.log(
                    "Search string: {search}".format(search=search_string), logger.DEBUG
                )

            search_string = "+".join(search_string.split())

            post_data = dict(
                {
                    "/browse.php?": None,
                    "cata": "yes",
                    "jxt": 8,
                    "jxw": "b",
                    "search": search_string,
                },
                **self.categories[mode],
            )

            if self.freeleech:
                post_data.update({"free": "on"})

            try:
                response = self.get_url(
                    self.urls["search"], post_data=post_data, returns="response"
                )
                response.raise_for_status()
            except RequestException as msg:
                logger.log(
                    "Error while connecting to provider: {error}".format(error=msg),
                    logger.ERROR,
                )
                continue

            if not response.content:
                logger.log("No data returned from provider", logger.DEBUG)
                continue

            try:
                jdata = response.json()
            except (
                ValueError
            ):  # also catches JSONDecodeError if simplejson is installed
                logger.log("No data returned from provider", logger.DEBUG)
                continue

            results += self.parse(jdata, mode)

    return results


# Traceback (ConnectionError)
FINDPROPERS :: [TorrentDay] :: [b9d562e] Error while connecting to provider: HTTPSConnectionPool(host='classic.torrentday.com', port=443): Max retries exceeded with url: /V3/API/API.php (Caused by NewConnectionError('<requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x6a6e0770>: Failed to establish a new connection: [Errno -2] Nome ou servi\xc3\xa7o desconhecido',))
Traceback (most recent call last):
File "/home/osmc/SickRage/sickbeard/providers/torrent/json/torrentday.py", line 100, in search
response = self.get_url(self.urls['search'], post_data=post_data, returns='response')
File "/home/osmc/SickRage/sickrage/providers/GenericProvider.py", line 395, in get_url
return getURL(url, post_data, params, self.headers, timeout, self.session, **kwargs)
File "/home/osmc/SickRage/sickbeard/helpers.py", line 1423, in getURL
verify=verify)
File "/home/osmc/SickRage/lib/requests/sessions.py", line 475, in request
resp = self.send(prep, **send_kwargs)
File "/home/osmc/SickRage/lib/requests/sessions.py", line 585, in send
r = adapter.send(request, **kwargs)
File "/home/osmc/SickRage/lib/cachecontrol/adapter.py", line 46, in send
resp = super(CacheControlAdapter, self).send(request, **kw)
File "/home/osmc/SickRage/lib/requests/adapters.py", line 467, in send
raise ConnectionError(e, request=request)
ConnectionError: HTTPSConnectionPool(host='classic.torrentday.com', port=443): Max retries exceeded with url: /V3/API/API.php (Caused by NewConnectionError('<requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x6a6e0770>: Failed to establish a new connection: [Errno -2] Nome ou servi\xc3\xa7o desconhecido',))

# Fixed code
def search(self, search_strings, age=0, ep_obj=None):  # pylint: disable=too-many-locals, too-many-branches
    """
    Search a provider and parse the results

    :param search_strings: A dict with mode (key) and the search value (value)
    :param age: Not used
    :param ep_obj: Not used
    :returns: A list of search results (structure)
    """
    results = []
    if not self.login():
        return results

    for mode in search_strings:
        logger.log("Search mode: {0}".format(mode), logger.DEBUG)

        for search_string in search_strings[mode]:
            if mode != "RSS":
                logger.log(
                    "Search string: {search}".format(search=search_string), logger.DEBUG
                )

            search_string = "+".join(search_string.split())

            post_data = dict(
                {
                    "/browse.php?": None,
                    "cata": "yes",
                    "jxt": 8,
                    "jxw": "b",
                    "search": search_string,
                },
                **self.categories[mode],
            )

            if self.freeleech:
                post_data.update({"free": "on"})

            response = self.get_url(
                self.urls["search"], post_data=post_data, returns="response"
            )
            if not response.content:
                logger.log("No data returned from provider", logger.DEBUG)
                continue

            try:
                jdata = response.json()
            except (
                ValueError
            ):  # also catches JSONDecodeError if simplejson is installed
                logger.log("No data returned from provider", logger.DEBUG)
                continue

            results += self.parse(jdata, mode)

    return results