# Buggy code
def __init__(self):
    """Initialize the class."""
    super(BinSearchProvider, self).__init__("BinSearch")

    # Credentials
    self.public = True

    # URLs
    self.url = "https://www.binsearch.info"
    self.urls = {
        "search": urljoin(self.url, "index.php"),
        "rss": urljoin(self.url, "browse.php"),
    }

    # Proper Strings
    self.proper_strings = ["PROPER", "REPACK", "REAL", "RERIP"]

    # Miscellaneous Options

    # Cache
    self.cache = tv.Cache(self, min_time=10)


# Traceback (AttributeError)
2018-08-04 15:19:22 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [Torrentz2] :: [f5973b2] 73871: 'Futurama' S06E11 status is: 'Snatched (Best)'. Ignoring result with quality 'SD DVD'. Reason: Episode status is not Downloaded, Snatched or Snatched Proper. Ignoring new quality
2018-08-04 15:19:22 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [Torrentz2] :: [f5973b2] Ignoring Futurama.S06E01-13.2010.DUAL.BDRip.XviD.AC3.-HQRips
2018-08-04 15:19:22 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [Torrentz2] :: [f5973b2] Matched release Hell.On.Wheels.S02E04.720p.WEB-DL.AAC2.0.H.264-CtrlHD.[PublicHD] to a series in your database: Hell on Wheels
2018-08-04 15:19:22 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [Torrentz2] :: [f5973b2] Parsed Hell.On.Wheels.S02E04.720p.WEB-DL.AAC2.0.H.264-CtrlHD.[PublicHD] into title: Hell On Wheels, season: 2, episode: [4], screen_size: 720p, format: WEB-DL, audio_codec: AAC, audio_channels: 2.0, video_codec: h264, release_group: CtrlHD, type: episode, parsing_time: 0.0310001373291, total_time: 0.0310001373291, absolute_episode: [], quality: 720p WEB-DL
2018-08-04 15:19:22 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [Torrentz2] :: [f5973b2] 212961: Allowed, Preferred = [ SD DVD, RawHD, 1080p HDTV, 720p WEB-DL, 1080p WEB-DL, 720p BluRay ] [ SD DVD, RawHD, 1080p HDTV, 720p WEB-DL ] Found = [ 720p WEB-DL ]
2018-08-04 15:19:22 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [Torrentz2] :: [f5973b2] 212961: 'Hell on Wheels' S02E04 status is: 'Downloaded'. Accepting result with quality '720p WEB-DL'. Reason: Existing quality is no longer in any wanted quality lists. Accepting new quality
2018-08-04 15:19:22 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [Torrentz2] :: [f5973b2] 212961: Using cached results from Torrentz2 for series u'Hell on Wheels' episode S02E04
2018-08-04 15:19:22 INFO     SEARCHQUEUE-DAILY-SEARCH :: [Torrentz2] :: [f5973b2] Quality of Futurama.S06E04.DvdRip.XviD.DutchReleaseTeam.(dutch.subs.nl) is SD DVD
2018-08-04 15:19:22 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [Torrentz2] :: [f5973b2] 73871: Allowed, Preferred = [ SD DVD, RawHD, 1080p HDTV, 720p WEB-DL, 1080p WEB-DL, 720p BluRay ] [ SD DVD, RawHD, 1080p HDTV, 720p WEB-DL ] Found = [ SD DVD ]
2018-08-04 15:19:22 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [Torrentz2] :: [f5973b2] 73871: 'Futurama' S06E04 status is: 'Downloaded'. Accepting result with quality 'SD DVD'. Reason: Existing quality is no longer in any wanted quality lists. Accepting new quality
2018-08-04 15:19:22 INFO     SEARCHQUEUE-DAILY-SEARCH :: [Torrentz2] :: [f5973b2] Ignoring Futurama.S06E04.DvdRip.XviD.DutchReleaseTeam.(dutch.subs.nl) based on ignored words filter: dutch
2018-08-04 15:19:22 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [Torrentz2] :: [f5973b2] No wanted results found.
2018-08-04 15:19:22 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [Torrentz2] :: [f5973b2] Matched release X:\TV\Futurama\Season 6\S06E04 - Proposition Infinity to a series in your database: Futurama
2018-08-04 15:19:22 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [Torrentz2] :: [f5973b2] Parsed X:\TV\Futurama\Season 6\S06E04 - Proposition Infinity into title: Futurama, season: 6, episode: [4], episode_title: Proposition Infinity, type: episode, parsing_time: 0.0239999294281, total_time: 0.0239999294281, absolute_episode: [], quality: SDTV
2018-08-04 15:19:22 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [Torrentz2] :: [f5973b2] Found codec for Futurama Proposition Infinity
2018-08-04 15:19:22 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [Torrentz2] :: [f5973b2] 73871: Formatting pattern: %SN - S%0SE04 - %EN -> Futurama - S06E04 - Proposition Infinity
2018-08-04 15:19:22 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [Torrentz2] :: [f5973b2] All found results for Futurama - S06E04 - Proposition Infinity were rejected.
2018-08-04 15:19:22 INFO     SEARCHQUEUE-DAILY-SEARCH :: [Torrentz2] :: [f5973b2] Quality of Eureka.S01E04.(2006).DVDRip.Dutch.subs.NLT.(DivX) is SD DVD
2018-08-04 15:19:22 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [Torrentz2] :: [f5973b2] 79334: Allowed, Preferred = [ SD DVD, RawHD, 1080p HDTV, 720p WEB-DL, 1080p WEB-DL, 720p BluRay ] [ SD DVD, RawHD, 1080p HDTV, 720p WEB-DL ] Found = [ SD DVD ]
2018-08-04 15:19:22 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [Torrentz2] :: [f5973b2] 79334: 'Eureka' S01E04 status is: 'Downloaded'. Accepting result with quality 'SD DVD'. Reason: Existing quality is no longer in any wanted quality lists. Accepting new quality
2018-08-04 15:19:22 INFO     SEARCHQUEUE-DAILY-SEARCH :: [Torrentz2] :: [f5973b2] Ignoring Eureka.S01E04.(2006).DVDRip.Dutch.subs.NLT.(DivX) based on ignored words filter: dutch
2018-08-04 15:19:22 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [Torrentz2] :: [f5973b2] No wanted results found.
2018-08-04 15:19:22 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [Torrentz2] :: [f5973b2] Matched release X:\TV\Eureka\Season 1\S01E04 - Alienated to a series in your database: Eureka
2018-08-04 15:19:22 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [Torrentz2] :: [f5973b2] Parsed X:\TV\Eureka\Season 1\S01E04 - Alienated into title: Eureka, season: 1, episode: [4], episode_title: Alienated, type: episode, parsing_time: 0.0199999809265, total_time: 0.0199999809265, absolute_episode: [], quality: Unknown
2018-08-04 15:19:22 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [Torrentz2] :: [f5973b2] Found codec for Eureka Alienated
2018-08-04 15:19:22 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [Torrentz2] :: [f5973b2] 79334: Formatting pattern: %SN - S%0SE04 - %EN -> Eureka - S01E04 - Alienated
2018-08-04 15:19:22 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [Torrentz2] :: [f5973b2] All found results for Eureka - S01E04 - Alienated were rejected.
2018-08-04 15:19:22 INFO     SEARCHQUEUE-DAILY-SEARCH :: [Torrentz2] :: [f5973b2] Quality of Anthony.Bourdain.Parts.Unknown.S10E02.French.Alps.720p.HDTV.x264-SOIL.mkv is 720p HDTV
2018-08-04 15:19:22 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [Torrentz2] :: [f5973b2] 264108: Allowed, Preferred = [ 720p HDTV, 1080p HDTV, 720p WEB-DL, 1080p WEB-DL, 720p BluRay, 1080p BluRay ] [ 720p HDTV, 1080p HDTV, 720p WEB-DL, 1080p WEB-DL ] Found = [ 720p HDTV ]
2018-08-04 15:19:22 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [Torrentz2] :: [f5973b2] 264108: 'Anthony Bourdain: Parts Unknown' S10E02 status is: 'Wanted'. Accepting result with quality '720p HDTV'. Reason: Current status is 'WANTED'. Accepting result with quality '720p HDTV'
2018-08-04 15:19:22 INFO     SEARCHQUEUE-DAILY-SEARCH :: [Torrentz2] :: [f5973b2] Ignoring Anthony.Bourdain.Parts.Unknown.S10E02.French.Alps.720p.HDTV.x264-SOIL.mkv based on ignored words filter: french
2018-08-04 15:19:22 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [Torrentz2] :: [f5973b2] No wanted results found.
2018-08-04 15:19:22 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [Torrentz2] :: [f5973b2] 264108: Formatting pattern: %SN - S%0SE02 - %EN -> Anthony Bourdain Parts Unknown - S10E02 - French Alps
2018-08-04 15:19:22 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [Torrentz2] :: [f5973b2] All found results for Anthony Bourdain Parts Unknown - S10E02 - French Alps were rejected.
2018-08-04 15:19:22 INFO     SEARCHQUEUE-DAILY-SEARCH :: [Torrentz2] :: [f5973b2] Quality of Eureka.S01E02.(2006).DVDRip.Dutch.subs.NLT.(DivX) is SD DVD
2018-08-04 15:19:22 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [Torrentz2] :: [f5973b2] 79334: Allowed, Preferred = [ SD DVD, RawHD, 1080p HDTV, 720p WEB-DL, 1080p WEB-DL, 720p BluRay ] [ SD DVD, RawHD, 1080p HDTV, 720p WEB-DL ] Found = [ SD DVD ]
2018-08-04 15:19:22 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [Torrentz2] :: [f5973b2] 79334: 'Eureka' S01E02 status is: 'Downloaded'. Accepting result with quality 'SD DVD'. Reason: Existing quality is no longer in any wanted quality lists. Accepting new quality
2018-08-04 15:19:22 INFO     SEARCHQUEUE-DAILY-SEARCH :: [Torrentz2] :: [f5973b2] Ignoring Eureka.S01E02.(2006).DVDRip.Dutch.subs.NLT.(DivX) based on ignored words filter: dutch
2018-08-04 15:19:22 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [Torrentz2] :: [f5973b2] No wanted results found.
2018-08-04 15:19:22 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [Torrentz2] :: [f5973b2] Matched release X:\TV\Eureka\Season 1\S01E02 - Many Happy Returns to a series in your database: Eureka
2018-08-04 15:19:22 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [Torrentz2] :: [f5973b2] Parsed X:\TV\Eureka\Season 1\S01E02 - Many Happy Returns into title: Eureka, season: 1, episode: [2], episode_title: Many Happy Returns, type: episode, parsing_time: 0.0210001468658, total_time: 0.0210001468658, absolute_episode: [], quality: Unknown
2018-08-04 15:19:22 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [Torrentz2] :: [f5973b2] Found codec for Eureka Many Happy Returns
2018-08-04 15:19:22 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [Torrentz2] :: [f5973b2] 79334: Formatting pattern: %SN - S%0SE02 - %EN -> Eureka - S01E02 - Many Happy Returns
2018-08-04 15:19:22 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [Torrentz2] :: [f5973b2] All found results for Eureka - S01E02 - Many Happy Returns were rejected.
2018-08-04 15:19:22 INFO     SEARCHQUEUE-DAILY-SEARCH :: [Torrentz2] :: [f5973b2] Quality of Eureka.S01E06.(2006).DVDRip.(Dutch.NL.subs).NLT.DivX is SD DVD
2018-08-04 15:19:22 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [Torrentz2] :: [f5973b2] 79334: Allowed, Preferred = [ SD DVD, RawHD, 1080p HDTV, 720p WEB-DL, 1080p WEB-DL, 720p BluRay ] [ SD DVD, RawHD, 1080p HDTV, 720p WEB-DL ] Found = [ SD DVD ]
2018-08-04 15:19:22 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [Torrentz2] :: [f5973b2] 79334: 'Eureka' S01E06 status is: 'Downloaded'. Accepting result with quality 'SD DVD'. Reason: Existing quality is no longer in any wanted quality lists. Accepting new quality
2018-08-04 15:19:22 INFO     SEARCHQUEUE-DAILY-SEARCH :: [Torrentz2] :: [f5973b2] Ignoring Eureka.S01E06.(2006).DVDRip.(Dutch.NL.subs).NLT.DivX based on ignored words filter: dutch
2018-08-04 15:19:22 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [Torrentz2] :: [f5973b2] No wanted results found.
2018-08-04 15:19:22 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [Torrentz2] :: [f5973b2] Matched release X:\TV\Eureka\Season 1\S01E06 - Dr. Nobel to a series in your database: Eureka
2018-08-04 15:19:22 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [Torrentz2] :: [f5973b2] Parsed X:\TV\Eureka\Season 1\S01E06 - Dr. Nobel into title: Eureka, season: 1, episode: [6], episode_title: Dr Nobel, type: episode, parsing_time: 0.0280001163483, total_time: 0.0280001163483, absolute_episode: [], quality: Unknown
2018-08-04 15:19:22 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [Torrentz2] :: [f5973b2] Found codec for Eureka Dr. Nobel
2018-08-04 15:19:22 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [Torrentz2] :: [f5973b2] 79334: Formatting pattern: %SN - S%0SE06 - %EN -> Eureka - S01E06 - Dr. Nobel
2018-08-04 15:19:22 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [Torrentz2] :: [f5973b2] All found results for Eureka - S01E06 - Dr. Nobel were rejected.
2018-08-04 15:19:22 INFO     SEARCHQUEUE-DAILY-SEARCH :: [Torrentz2] :: [f5973b2] Quality of Eureka.S01E01.(2006).DVDRip.Dutch.subs.NLT.(DivX) is SD DVD
2018-08-04 15:19:22 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [Torrentz2] :: [f5973b2] 79334: Allowed, Preferred = [ SD DVD, RawHD, 1080p HDTV, 720p WEB-DL, 1080p WEB-DL, 720p BluRay ] [ SD DVD, RawHD, 1080p HDTV, 720p WEB-DL ] Found = [ SD DVD ]
2018-08-04 15:19:22 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [Torrentz2] :: [f5973b2] 79334: 'Eureka' S01E01 status is: 'Downloaded'. Accepting result with quality 'SD DVD'. Reason: Existing quality is no longer in any wanted quality lists. Accepting new quality
2018-08-04 15:19:22 INFO     SEARCHQUEUE-DAILY-SEARCH :: [Torrentz2] :: [f5973b2] Ignoring Eureka.S01E01.(2006).DVDRip.Dutch.subs.NLT.(DivX) based on ignored words filter: dutch
2018-08-04 15:19:22 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [Torrentz2] :: [f5973b2] No wanted results found.
2018-08-04 15:19:22 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [Torrentz2] :: [f5973b2] Matched release X:\TV\Eureka\Season 1\S01E01 - Pilot to a series in your database: Eureka
2018-08-04 15:19:22 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [Torrentz2] :: [f5973b2] Parsed X:\TV\Eureka\Season 1\S01E01 - Pilot into title: Eureka, season: 1, episode: [1], episode_title: Pilot, type: episode, parsing_time: 0.0230000019073, total_time: 0.0230000019073, absolute_episode: [], quality: Unknown
2018-08-04 15:19:22 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [Torrentz2] :: [f5973b2] Found codec for Eureka Pilot
2018-08-04 15:19:22 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [Torrentz2] :: [f5973b2] 79334: Formatting pattern: %SN - S%0SE01 - %EN -> Eureka - S01E01 - Pilot
2018-08-04 15:19:22 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [Torrentz2] :: [f5973b2] All found results for Eureka - S01E01 - Pilot were rejected.
2018-08-04 15:19:22 INFO     SEARCHQUEUE-DAILY-SEARCH :: [Torrentz2] :: [f5973b2] Quality of Hell.On.Wheels.S02E04.720p.WEB-DL.AAC2.0.H.264-CtrlHD.[PublicHD] is 720p WEB-DL
2018-08-04 15:19:22 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [Torrentz2] :: [f5973b2] 212961: Allowed, Preferred = [ SD DVD, RawHD, 1080p HDTV, 720p WEB-DL, 1080p WEB-DL, 720p BluRay ] [ SD DVD, RawHD, 1080p HDTV, 720p WEB-DL ] Found = [ 720p WEB-DL ]
2018-08-04 15:19:22 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [Torrentz2] :: [f5973b2] 212961: 'Hell on Wheels' S02E04 status is: 'Downloaded'. Accepting result with quality '720p WEB-DL'. Reason: Existing quality is no longer in any wanted quality lists. Accepting new quality
2018-08-04 15:19:22 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [Torrentz2] :: [f5973b2] Found wanted results.
2018-08-04 15:19:22 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [Torrentz2] :: [f5973b2] Sorting the following results: [u'Hell.On.Wheels.S02E04.720p.WEB-DL.AAC2.0.H.264-CtrlHD.[PublicHD]']
2018-08-04 15:19:22 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [Torrentz2] :: [f5973b2] Computed result scores:
Score  Release
100.00 Hell.On.Wheels.S02E04.720p.WEB-DL.AAC2.0.H.264-CtrlHD.[PublicHD]
2018-08-04 15:19:22 INFO     SEARCHQUEUE-DAILY-SEARCH :: [Torrentz2] :: [f5973b2] Picked Hell.On.Wheels.S02E04.720p.WEB-DL.AAC2.0.H.264-CtrlHD.[PublicHD] as the best result.
2018-08-04 15:19:22 INFO     SEARCHQUEUE-DAILY-SEARCH :: [f5973b2] Downloading King.of.the.Hill.S13E08.720p.WEB-DL.DD5.1.H.264-MURPHY with size: 0.00 B from BinSearch
2018-08-04 15:19:22 INFO     SEARCHQUEUE-DAILY-SEARCH :: [f5973b2] Downloading King.of.the.Hill.S13E08.720p.WEB-DL.DD5.1.H.264-MURPHY from BinSearch at https://www.binsearch.info/fcgi/nzb.fcgi?adv_age=&max=250&server=1&q=King+of+the+Hill+S13E08&xminsize=20|nzb_id=248136468 and data {u'action': u'nzb', u'248136468': u'on'}
2018-08-04 15:19:44 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [f5973b2] Error requesting url https://www.binsearch.info/fcgi/nzb.fcgi?adv_age=&max=250&server=1&q=King+of+the+Hill+S13E08&xminsize=20 Error: ('Connection aborted.', error(10054, 'An existing connection was forcibly closed by the remote host'))
2018-08-04 15:19:44 ERROR    SEARCHQUEUE-DAILY-SEARCH :: [f5973b2] DailySearchQueueItem Exception, error: 'NoneType' object has no attribute 'content'
Traceback (most recent call last):
  File "C:\Medusa\Medusa\medusa\search\queue.py", line 289, in run
    self.success = snatch_episode(result)
  File "C:\Medusa\Medusa\medusa\search\core.py", line 135, in snatch_episode
    nzb_data = result.provider.download_nzb_for_post(result)
  File "C:\Medusa\Medusa\medusa\providers\nzb\binsearch.py", line 267, in download_nzb_for_post
    verify=verify, hooks={}, allow_redirects=True).content
AttributeError: 'NoneType' object has no attribute 'content'

# Fixed code
def __init__(self):
    """Initialize the class."""
    super(BinSearchProvider, self).__init__("BinSearch")

    # Credentials
    self.public = True

    # URLs
    self.url = "https://www.binsearch.info"
    self.urls = {
        "search": urljoin(self.url, "index.php"),
        "rss": urljoin(self.url, "browse.php"),
    }

    # Proper Strings
    self.proper_strings = ["PROPER", "REPACK", "REAL", "RERIP"]

    # Miscellaneous Options

    # Cache
    self.cache = tv.Cache(self, min_time=10)