# Buggy code
def _api_call(self, params=None, results_per_page=300, offset=0):
    """Call provider API."""
    parsed_json = {}

    try:
        server = jsonrpclib.Server(self.urls["base_url"])
        parsed_json = server.getTorrents(
            self.api_key, params or {}, int(results_per_page), int(offset)
        )
        time.sleep(cpu_presets[app.CPU_PRESET])
    except jsonrpclib.jsonrpc.ProtocolError as error:
        message = error.args[0]
        if message == (-32001, "Invalid API Key"):
            log.warning("Incorrect authentication credentials.")
        elif message == (-32002, "Call Limit Exceeded"):
            log.warning("You have exceeded the limit of 150 calls per hour.")
        elif isinstance(message, tuple) and message[1] in (
            500,
            524,
        ):
            log.warning(
                "Provider is currently unavailable. Error: {code} {text}",
                {"code": message[1], "text": message[2]},
            )
        else:
            log.error(
                "JSON-RPC protocol error while accessing provider. Error: {msg!r}",
                {"msg": message},
            )

    except (socket.error, ValueError) as error:
        log.warning("Error while accessing provider. Error: {msg!r}", {"msg": error})
    return parsed_json


# Traceback (ConnectionError)
2018-08-29 06:18:49 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [Torrentz2] :: [f5973b2] Found wanted results.
2018-08-29 06:18:49 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [Torrentz2] :: [f5973b2] Sorting the following results: [u'Salvation.S02E10.720p.HDTV.x264-AVS[eztv].mkv', u'Salvation.S02E10.720p.HDTV.x264-AVS[TGx]']
2018-08-29 06:18:49 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [Torrentz2] :: [f5973b2] Computed result scores:
Score  Release
100.00 Salvation.S02E10.720p.HDTV.x264-AVS[eztv].mkv
100.00 Salvation.S02E10.720p.HDTV.x264-AVS[TGx]
2018-08-29 06:18:49 INFO     SEARCHQUEUE-DAILY-SEARCH :: [Torrentz2] :: [f5973b2] Picked Salvation.S02E10.720p.HDTV.x264-AVS[eztv].mkv as the best result.
2018-08-29 06:18:49 INFO     SEARCHQUEUE-DAILY-SEARCH :: [Torrentz2] :: [f5973b2] Quality of Bitchin.Rides.S01E03.More.Than.One.Way.to.Skin.a.Cat.720p.HDTV.x264-DHD[et] is 720p HDTV
2018-08-29 06:18:49 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [Torrentz2] :: [f5973b2] 285605: Allowed, Preferred = [ SDTV, SD DVD, 720p HDTV, 1080p HDTV, 720p WEB-DL, 1080p WEB-DL, 720p BluRay, 1080p BluRay, 4K UHD TV, 4K UHD WEB-DL, 4K UHD BluRay, 8K UHD TV, 8K UHD WEB-DL, 8K UHD BluRay ] [ None ] Found = [ 720p HDTV ]
2018-08-29 06:18:49 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [Torrentz2] :: [f5973b2] 285605: 'Bitchin' Rides' S01E03 status is: 'Wanted'. Accepting result with quality '720p HDTV'. Reason: Current status is 'WANTED'. Accepting result with quality '720p HDTV'
2018-08-29 06:18:49 INFO     SEARCHQUEUE-DAILY-SEARCH :: [Torrentz2] :: [f5973b2] Discarding torrent because it does not meet the minimum provider setting S:2 L:0. Result has S:1 L:1
2018-08-29 06:18:49 INFO     SEARCHQUEUE-DAILY-SEARCH :: [Torrentz2] :: [f5973b2] Quality of [.www.torrenting.com.].-.Bitchin.Rides.S01E03.More.Than.One.Way.to.Skin.a.Cat.480p.HDTV.x264-mSD is SDTV
2018-08-29 06:18:49 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [Torrentz2] :: [f5973b2] 285605: Allowed, Preferred = [ SDTV, SD DVD, 720p HDTV, 1080p HDTV, 720p WEB-DL, 1080p WEB-DL, 720p BluRay, 1080p BluRay, 4K UHD TV, 4K UHD WEB-DL, 4K UHD BluRay, 8K UHD TV, 8K UHD WEB-DL, 8K UHD BluRay ] [ None ] Found = [ SDTV ]
2018-08-29 06:18:49 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [Torrentz2] :: [f5973b2] 285605: 'Bitchin' Rides' S01E03 status is: 'Wanted'. Accepting result with quality 'SDTV'. Reason: Current status is 'WANTED'. Accepting result with quality 'SDTV'
2018-08-29 06:18:49 INFO     SEARCHQUEUE-DAILY-SEARCH :: [Torrentz2] :: [f5973b2] Discarding torrent because it does not meet the minimum provider setting S:2 L:0. Result has S:1 L:6
2018-08-29 06:18:49 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [Torrentz2] :: [f5973b2] No wanted results found.
2018-08-29 06:18:49 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [Torrentz2] :: [f5973b2] Matched release G:\Series\Bitchin' Rides\Season 01\Bitchin' Rides - S01E03 - More than One Way to Skin a Cat (and a Bird) to a series in your database: Bitchin' Rides
2018-08-29 06:18:49 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [Torrentz2] :: [f5973b2] Parsed G:\Series\Bitchin' Rides\Season 01\Bitchin' Rides - S01E03 - More than One Way to Skin a Cat (and a Bird) into title: Bitchin' Rides, season: 1, episode: [3], episode_title: More than One Way to Skin a, language: ca, release_group: and a Bird, type: episode, parsing_time: 0.141000032425, total_time: 0.141000032425, absolute_episode: [], quality: Unknown
2018-08-29 06:18:49 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [Torrentz2] :: [f5973b2] 285605: Formatting pattern: %SN - S%0SE03 - %EN -> Bitchin' Rides - S01E03 - More than One Way to Skin a Cat (and a Bird)
2018-08-29 06:18:49 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [Torrentz2] :: [f5973b2] All found results for Bitchin' Rides - S01E03 - More than One Way to Skin a Cat (and a Bird) were rejected.
2018-08-29 06:18:49 INFO     SEARCHQUEUE-DAILY-SEARCH :: [Torrentz2] :: [f5973b2] Quality of Ballers.2015.S04E03.1080p.WEB.X264-METCON[TGx] is 1080p WEB-DL
2018-08-29 06:18:49 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [Torrentz2] :: [f5973b2] 281714: Allowed, Preferred = [ 720p HDTV, 1080p HDTV, 720p WEB-DL, 1080p WEB-DL, 720p BluRay, 1080p BluRay ] [ None ] Found = [ 1080p WEB-DL ]
2018-08-29 06:18:49 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [Torrentz2] :: [f5973b2] 281714: 'Ballers' S04E03 status is: 'Wanted'. Accepting result with quality '1080p WEB-DL'. Reason: Current status is 'WANTED'. Accepting result with quality '1080p WEB-DL'
2018-08-29 06:18:49 INFO     SEARCHQUEUE-DAILY-SEARCH :: [Torrentz2] :: [f5973b2] Quality of Ballers.2015.S04E03.720p.WEB.X264-METCON[eztv].mkv is 720p WEB-DL
2018-08-29 06:18:49 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [Torrentz2] :: [f5973b2] 281714: Allowed, Preferred = [ 720p HDTV, 1080p HDTV, 720p WEB-DL, 1080p WEB-DL, 720p BluRay, 1080p BluRay ] [ None ] Found = [ 720p WEB-DL ]
2018-08-29 06:18:49 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [Torrentz2] :: [f5973b2] 281714: 'Ballers' S04E03 status is: 'Wanted'. Accepting result with quality '720p WEB-DL'. Reason: Current status is 'WANTED'. Accepting result with quality '720p WEB-DL'
2018-08-29 06:18:49 INFO     SEARCHQUEUE-DAILY-SEARCH :: [Torrentz2] :: [f5973b2] Quality of Ballers.2015.S04E03.720p.WEB.X264-METCON[TGx] is 720p WEB-DL
2018-08-29 06:18:49 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [Torrentz2] :: [f5973b2] 281714: Allowed, Preferred = [ 720p HDTV, 1080p HDTV, 720p WEB-DL, 1080p WEB-DL, 720p BluRay, 1080p BluRay ] [ None ] Found = [ 720p WEB-DL ]
2018-08-29 06:18:49 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [Torrentz2] :: [f5973b2] 281714: 'Ballers' S04E03 status is: 'Wanted'. Accepting result with quality '720p WEB-DL'. Reason: Current status is 'WANTED'. Accepting result with quality '720p WEB-DL'
2018-08-29 06:18:49 INFO     SEARCHQUEUE-DAILY-SEARCH :: [Torrentz2] :: [f5973b2] Quality of Ballers.2015.S04E03.720p.WEB.X264-METCON[ettv] is 720p WEB-DL
2018-08-29 06:18:49 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [Torrentz2] :: [f5973b2] 281714: Allowed, Preferred = [ 720p HDTV, 1080p HDTV, 720p WEB-DL, 1080p WEB-DL, 720p BluRay, 1080p BluRay ] [ None ] Found = [ 720p WEB-DL ]
2018-08-29 06:18:49 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [Torrentz2] :: [f5973b2] 281714: 'Ballers' S04E03 status is: 'Wanted'. Accepting result with quality '720p WEB-DL'. Reason: Current status is 'WANTED'. Accepting result with quality '720p WEB-DL'
2018-08-29 06:18:49 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [Torrentz2] :: [f5973b2] Found wanted results.
2018-08-29 06:18:49 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [Torrentz2] :: [f5973b2] Sorting the following results: [u'Ballers.2015.S04E03.1080p.WEB.X264-METCON[TGx]', u'Ballers.2015.S04E03.720p.WEB.X264-METCON[eztv].mkv', u'Ballers.2015.S04E03.720p.WEB.X264-METCON[TGx]', u'Ballers.2015.S04E03.720p.WEB.X264-METCON[ettv]']
2018-08-29 06:18:49 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [Torrentz2] :: [f5973b2] Computed result scores:
Score  Release
100.00 Ballers.2015.S04E03.1080p.WEB.X264-METCON[TGx]
100.00 Ballers.2015.S04E03.720p.WEB.X264-METCON[eztv].mkv
100.00 Ballers.2015.S04E03.720p.WEB.X264-METCON[TGx]
100.00 Ballers.2015.S04E03.720p.WEB.X264-METCON[ettv]
2018-08-29 06:18:49 INFO     SEARCHQUEUE-DAILY-SEARCH :: [Torrentz2] :: [f5973b2] Picked Ballers.2015.S04E03.1080p.WEB.X264-METCON[TGx] as the best result.
2018-08-29 06:18:49 INFO     SEARCHQUEUE-DAILY-SEARCH :: [Torrentz2] :: [f5973b2] Quality of Junkyard.Empire.S03E06.Too.Much.Rough.Not.Enough.Diamond.720p.XviD is 720p HDTV
2018-08-29 06:18:49 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [Torrentz2] :: [f5973b2] 294666: Allowed, Preferred = [ SDTV, SD DVD, 720p HDTV, 1080p HDTV, 720p WEB-DL, 1080p WEB-DL, 720p BluRay, 1080p BluRay, 4K UHD TV, 4K UHD WEB-DL, 4K UHD BluRay, 8K UHD TV, 8K UHD WEB-DL, 8K UHD BluRay ] [ None ] Found = [ 720p HDTV ]
2018-08-29 06:18:49 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [Torrentz2] :: [f5973b2] 294666: 'Junkyard Empire' S03E06 status is: 'Wanted'. Accepting result with quality '720p HDTV'. Reason: Current status is 'WANTED'. Accepting result with quality '720p HDTV'
2018-08-29 06:18:49 INFO     SEARCHQUEUE-DAILY-SEARCH :: [Torrentz2] :: [f5973b2] Discarding torrent because it does not meet the minimum provider setting S:2 L:0. Result has S:1 L:1
2018-08-29 06:18:49 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [Torrentz2] :: [f5973b2] No wanted results found.
2018-08-29 06:18:49 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [Torrentz2] :: [f5973b2] 294666: Formatting pattern: %SN - S%0SE06 - %EN -> Junkyard Empire - S03E06 - Too Much Rough, Not Enough Diamond
2018-08-29 06:18:49 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [Torrentz2] :: [f5973b2] All found results for Junkyard Empire - S03E06 - Too Much Rough, Not Enough Diamond were rejected.
2018-08-29 06:18:49 INFO     SEARCHQUEUE-DAILY-SEARCH :: [Torrentz2] :: [f5973b2] Quality of Treehouse.Masters.S11E01.Hawaiian.Island.Treehouse.Adventure.WEB.x264-CAFFEiNE[eztv].mkv is SDTV
2018-08-29 06:18:49 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [Torrentz2] :: [f5973b2] 270071: Allowed, Preferred = [ SDTV, SD DVD, 720p HDTV, 1080p HDTV, 720p WEB-DL, 1080p WEB-DL, 720p BluRay, 1080p BluRay, 4K UHD TV, 4K UHD WEB-DL, 4K UHD BluRay, 8K UHD TV, 8K UHD WEB-DL, 8K UHD BluRay ] [ None ] Found = [ SDTV ]
2018-08-29 06:18:49 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [Torrentz2] :: [f5973b2] 270071: 'Treehouse Masters' S11E01 status is: 'Wanted'. Accepting result with quality 'SDTV'. Reason: Current status is 'WANTED'. Accepting result with quality 'SDTV'
2018-08-29 06:18:49 INFO     SEARCHQUEUE-DAILY-SEARCH :: [Torrentz2] :: [f5973b2] Quality of Treehouse.Masters.S11E01.Hawaiian.Island.Treehouse.Adventure.WEB.x264-CAFFEiNE[ettv] is SDTV
2018-08-29 06:18:49 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [Torrentz2] :: [f5973b2] 270071: Allowed, Preferred = [ SDTV, SD DVD, 720p HDTV, 1080p HDTV, 720p WEB-DL, 1080p WEB-DL, 720p BluRay, 1080p BluRay, 4K UHD TV, 4K UHD WEB-DL, 4K UHD BluRay, 8K UHD TV, 8K UHD WEB-DL, 8K UHD BluRay ] [ None ] Found = [ SDTV ]
2018-08-29 06:18:49 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [Torrentz2] :: [f5973b2] 270071: 'Treehouse Masters' S11E01 status is: 'Wanted'. Accepting result with quality 'SDTV'. Reason: Current status is 'WANTED'. Accepting result with quality 'SDTV'
2018-08-29 06:18:50 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [Torrentz2] :: [f5973b2] Found wanted results.
2018-08-29 06:18:50 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [Torrentz2] :: [f5973b2] Sorting the following results: [u'Treehouse.Masters.S11E01.Hawaiian.Island.Treehouse.Adventure.WEB.x264-CAFFEiNE[eztv].mkv', u'Treehouse.Masters.S11E01.Hawaiian.Island.Treehouse.Adventure.WEB.x264-CAFFEiNE[ettv]']
2018-08-29 06:18:50 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [Torrentz2] :: [f5973b2] Computed result scores:
Score  Release
100.00 Treehouse.Masters.S11E01.Hawaiian.Island.Treehouse.Adventure.WEB.x264-CAFFEiNE[eztv].mkv
100.00 Treehouse.Masters.S11E01.Hawaiian.Island.Treehouse.Adventure.WEB.x264-CAFFEiNE[ettv]
2018-08-29 06:18:50 INFO     SEARCHQUEUE-DAILY-SEARCH :: [Torrentz2] :: [f5973b2] Picked Treehouse.Masters.S11E01.Hawaiian.Island.Treehouse.Adventure.WEB.x264-CAFFEiNE[eztv].mkv as the best result.
2018-08-29 06:18:50 INFO     SEARCHQUEUE-DAILY-SEARCH :: [Torrentz2] :: [f5973b2] Quality of Bitchin.Rides.S01E06.The.Juice.Is.Worth.the.Squeeze.720p.HDTV.x264-DHD[et] is 720p HDTV
2018-08-29 06:18:50 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [Torrentz2] :: [f5973b2] 285605: Allowed, Preferred = [ SDTV, SD DVD, 720p HDTV, 1080p HDTV, 720p WEB-DL, 1080p WEB-DL, 720p BluRay, 1080p BluRay, 4K UHD TV, 4K UHD WEB-DL, 4K UHD BluRay, 8K UHD TV, 8K UHD WEB-DL, 8K UHD BluRay ] [ None ] Found = [ 720p HDTV ]
2018-08-29 06:18:50 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [Torrentz2] :: [f5973b2] 285605: 'Bitchin' Rides' S01E06 status is: 'Wanted'. Accepting result with quality '720p HDTV'. Reason: Current status is 'WANTED'. Accepting result with quality '720p HDTV'
2018-08-29 06:18:50 INFO     SEARCHQUEUE-DAILY-SEARCH :: [Torrentz2] :: [f5973b2] Discarding torrent because it does not meet the minimum provider setting S:2 L:0. Result has S:1 L:1
2018-08-29 06:18:50 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [Torrentz2] :: [f5973b2] No wanted results found.
2018-08-29 06:18:50 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [Torrentz2] :: [f5973b2] Matched release G:\Series\Bitchin' Rides\Season 01\Bitchin' Rides - S01E06 - The Juice Is Worth the Squeeze to a series in your database: Bitchin' Rides
2018-08-29 06:18:50 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [Torrentz2] :: [f5973b2] Parsed G:\Series\Bitchin' Rides\Season 01\Bitchin' Rides - S01E06 - The Juice Is Worth the Squeeze into title: Bitchin' Rides, season: 1, episode: [6], episode_title: The Juice Is Worth the Squeeze, type: episode, parsing_time: 0.125, total_time: 0.125, absolute_episode: [], quality: Unknown
2018-08-29 06:18:50 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [Torrentz2] :: [f5973b2] 285605: Formatting pattern: %SN - S%0SE06 - %EN -> Bitchin' Rides - S01E06 - The Juice Is Worth the Squeeze
2018-08-29 06:18:50 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [Torrentz2] :: [f5973b2] All found results for Bitchin' Rides - S01E06 - The Juice Is Worth the Squeeze were rejected.
2018-08-29 06:18:50 INFO     SEARCHQUEUE-DAILY-SEARCH :: [Torrentz2] :: [f5973b2] Quality of Diesel.Brothers.S04E05.WEB.x264-TBS[TGx] is SDTV
2018-08-29 06:18:50 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [Torrentz2] :: [f5973b2] 304932: Allowed, Preferred = [ SDTV, SD DVD, 720p HDTV, 1080p HDTV, 720p WEB-DL, 1080p WEB-DL, 720p BluRay, 1080p BluRay, 4K UHD TV, 4K UHD WEB-DL, 4K UHD BluRay, 8K UHD TV, 8K UHD WEB-DL, 8K UHD BluRay ] [ None ] Found = [ SDTV ]
2018-08-29 06:18:50 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [Torrentz2] :: [f5973b2] 304932: 'Diesel Brothers' S04E05 status is: 'Wanted'. Accepting result with quality 'SDTV'. Reason: Current status is 'WANTED'. Accepting result with quality 'SDTV'
2018-08-29 06:18:50 INFO     SEARCHQUEUE-DAILY-SEARCH :: [Torrentz2] :: [f5973b2] Quality of Diesel.Brothers.S04E05.WEB.x264-TBS[eztv].mkv is SDTV
2018-08-29 06:18:50 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [Torrentz2] :: [f5973b2] 304932: Allowed, Preferred = [ SDTV, SD DVD, 720p HDTV, 1080p HDTV, 720p WEB-DL, 1080p WEB-DL, 720p BluRay, 1080p BluRay, 4K UHD TV, 4K UHD WEB-DL, 4K UHD BluRay, 8K UHD TV, 8K UHD WEB-DL, 8K UHD BluRay ] [ None ] Found = [ SDTV ]
2018-08-29 06:18:50 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [Torrentz2] :: [f5973b2] 304932: 'Diesel Brothers' S04E05 status is: 'Wanted'. Accepting result with quality 'SDTV'. Reason: Current status is 'WANTED'. Accepting result with quality 'SDTV'
2018-08-29 06:18:50 INFO     SEARCHQUEUE-DAILY-SEARCH :: [Torrentz2] :: [f5973b2] Quality of Diesel.Brothers.S04E05.WEB.x264-TBS[ettv] is SDTV
2018-08-29 06:18:50 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [Torrentz2] :: [f5973b2] 304932: Allowed, Preferred = [ SDTV, SD DVD, 720p HDTV, 1080p HDTV, 720p WEB-DL, 1080p WEB-DL, 720p BluRay, 1080p BluRay, 4K UHD TV, 4K UHD WEB-DL, 4K UHD BluRay, 8K UHD TV, 8K UHD WEB-DL, 8K UHD BluRay ] [ None ] Found = [ SDTV ]
2018-08-29 06:18:50 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [Torrentz2] :: [f5973b2] 304932: 'Diesel Brothers' S04E05 status is: 'Wanted'. Accepting result with quality 'SDTV'. Reason: Current status is 'WANTED'. Accepting result with quality 'SDTV'
2018-08-29 06:18:50 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [Torrentz2] :: [f5973b2] Found wanted results.
2018-08-29 06:18:50 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [Torrentz2] :: [f5973b2] Sorting the following results: [u'Diesel.Brothers.S04E05.WEB.x264-TBS[TGx]', u'Diesel.Brothers.S04E05.WEB.x264-TBS[eztv].mkv', u'Diesel.Brothers.S04E05.WEB.x264-TBS[ettv]']
2018-08-29 06:18:50 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [Torrentz2] :: [f5973b2] Computed result scores:
Score  Release
100.00 Diesel.Brothers.S04E05.WEB.x264-TBS[TGx]
100.00 Diesel.Brothers.S04E05.WEB.x264-TBS[eztv].mkv
100.00 Diesel.Brothers.S04E05.WEB.x264-TBS[ettv]
2018-08-29 06:18:50 INFO     SEARCHQUEUE-DAILY-SEARCH :: [Torrentz2] :: [f5973b2] Picked Diesel.Brothers.S04E05.WEB.x264-TBS[TGx] as the best result.
2018-08-29 06:18:50 INFO     SEARCHQUEUE-DAILY-SEARCH :: [f5973b2] Downloading Salvation.S02E10.1080p.WEB.x264-TBS[TGx] with 29 seeders and 27 leechers and size 1.30 GB from Zooqle
2018-08-29 06:18:50 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [f5973b2] Calling uTorrent Client
2018-08-29 06:18:52 ERROR    SEARCHQUEUE-DAILY-SEARCH :: [f5973b2] DailySearchQueueItem Exception, error: HTTPConnectionPool(host='localhost', port=8086): Max retries exceeded with url: /gui/token.html (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x00000000113C6E48>: Failed to establish a new connection: [Errno 10061] Kan geen verbinding maken omdat de doelcomputer de verbinding actief heeft geweigerd',))
Traceback (most recent call last):
  File "C:\Medusa\medusa\search\queue.py", line 289, in run
    self.success = snatch_episode(result)
  File "C:\Medusa\medusa\search\core.py", line 170, in snatch_episode
    result_downloaded = client.send_torrent(result)
  File "C:\Medusa\medusa\clients\torrent\generic.py", line 246, in send_torrent
    if not self._get_auth():
  File "C:\Medusa\medusa\clients\torrent\utorrent_client.py", line 76, in _get_auth
    self.response = self.session.get(urljoin(self.url, 'token.html'), verify=False)
  File "C:\Medusa\ext\requests\sessions.py", line 525, in get
    return self.request('GET', url, **kwargs)
  File "C:\Medusa\medusa\session\core.py", line 102, in request
    timeout=timeout, verify=ssl_cert, **kwargs)
  File "C:\Medusa\ext\requests\sessions.py", line 512, in request
    resp = self.send(prep, **send_kwargs)
  File "C:\Medusa\ext\requests\sessions.py", line 622, in send
    r = adapter.send(request, **kwargs)
  File "C:\Medusa\ext\requests\adapters.py", line 513, in send
    raise ConnectionError(e, request=request)
ConnectionError: HTTPConnectionPool(host='localhost', port=8086): Max retries exceeded with url: /gui/token.html (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x00000000113C6E48>: Failed to establish a new connection: [Errno 10061] Kan geen verbinding maken omdat de doelcomputer de verbinding actief heeft geweigerd',))

# Fixed code
def _api_call(self, params=None, results_per_page=300, offset=0):
    """Call provider API."""
    parsed_json = {}

    try:
        server = jsonrpclib.Server(self.urls["base_url"])
        parsed_json = server.getTorrents(
            self.api_key, params or {}, int(results_per_page), int(offset)
        )
        time.sleep(cpu_presets[app.CPU_PRESET])
    except jsonrpclib.jsonrpc.ProtocolError as error:
        code, message = normalize_protocol_error(error)
        if (code, message) == (-32001, "Invalid API Key"):
            log.warning("Incorrect authentication credentials.")
        elif (code, message) == (-32002, "Call Limit Exceeded"):
            log.warning("You have exceeded the limit of 150 calls per hour.")
        elif code in (500, 524):
            log.warning(
                "Provider is currently unavailable. Error: {code} {text}",
                {"code": code, "text": message},
            )
        else:
            log.error(
                "JSON-RPC protocol error while accessing provider. Error: {msg!r}",
                {"msg": error.args},
            )

    except (socket.error, ValueError) as error:
        log.warning("Error while accessing provider. Error: {msg!r}", {"msg": error})
    return parsed_json