Repository: pymedusa/Medusa

Issue:
AttributeError: 'NoneType' object has no attribute 'indexer'
@p0psicles 

@ratoaq2 I only saw this issue in log, didn't got any traceback. know why?

```
2016-12-02 19:05:00 INFO     FINDPROPERS :: [Rarbg] :: [1d6c65b] Searching for any new PROPER releases from Rarbg
2016-12-02 19:05:01 DEBUG    FINDPROPERS :: [Rarbg] :: [1d6c65b] GET URL: http://torrentapi.org/pubapi_v2.php?get_token=get_token&app_id=medusa&format=json [Status: 200]
2016-12-02 19:05:01 DEBUG    FINDPROPERS :: [Rarbg] :: [1d6c65b] Search mode: Episode
2016-12-02 19:05:01 DEBUG    FINDPROPERS :: [Rarbg] :: [1d6c65b] Unknown exception while searching for propers in Rarbg, skipping: 'NoneType' object has no attribute 'indexer'
2016-12-02 19:05:01 DEBUG    FINDPROPERS :: [Rarbg] :: [1d6c65b] Traceback (most recent call last):
  File "C:/Users/Fernando/Documents/Medusa\medusa\search\proper.py", line 137, in _get_proper_results
    cur_propers = cur_provider.find_propers(recently_aired)
  File "C:/Users/Fernando/Documents/Medusa\medusa\providers\generic_provider.py", line 148, in find_propers
    for item in self.search(search_strings[0], ep_obj=episode_obj):
  File "C:/Users/Fernando/Documents/Medusa\medusa\providers\torrent\json\rarbg.py", line 99, in search
    search_params['search_tvdb'] = self._get_tvdb_id()
  File "C:/Users/Fernando/Documents/Medusa\medusa\providers\generic_provider.py", line 486, in _get_tvdb_id
    return self.show.indexerid if self.show.indexer == INDEXER_TVDBV2 else self.show.externals.get('tvdb_id')
AttributeError: 'NoneType' object has no attribute 'indexer'
```


Discussion:
Aaah yes, that was the proper issue. Forgot about that one!
when debugging, in rarbg.py, the self is the show and self.show.indexer = 1

but when it go to generic_provider, show is none:
![image](https://cloud.githubusercontent.com/assets/2620870/20850624/40f60488-b8c3-11e6-9963-b7366a14b9dd.png)

how come BTN works and uses the same code?
Good question. Dunno. Will look at it tomorrow.
is this related?

https://github.com/pymedusa/Medusa/commit/83c0a76058afb1da32d9f5868ea77c46307c49ae#diff-8f50bd624d67da320df146adc0eec690R37

 ping @ratoaq2 as he asked to change that.

Not related. i just tested.
### INFO
**Python Version**: `2.7.9 (default, Sep 17 2016, 20:26:04) [GCC 4.9.2]`
**Operating System**: `Linux-4.4.38-v7+-armv7l-with-debian-8.0`
**Locale**: `UTF-8`
**Branch**: [develop](../tree/develop)
**Database**: `44.5`
**Commit**: pymedusa/Medusa@d8dee4e20b9df4dfb6ae940942970b97518a2d79
**Link to Log**: https://gist.github.com/06e0f9d25650190268e794694cbcbcb5
### ERROR
<pre>
2017-03-01 11:04:43 ERROR    SEARCHQUEUE-BACKLOG-256115 :: [d8dee4e] Checking AniDB scene exceptions update failed for Tatort. Error: 'NoneType' object has no attribute 'findall'
Traceback (most recent call last):
  File "/home/pi/Medusa/<a href="../blob/d8dee4e20b9df4dfb6ae940942970b97518a2d79/medusa/scene_exceptions.py#L409">medusa/scene_exceptions.py</a>", line 409, in _get_anidb_exceptions
    autoCorrectName=True
  File "/home/pi/Medusa/<a href="../blob/d8dee4e20b9df4dfb6ae940942970b97518a2d79/lib/adba/aniDBAbstracter.py#L131">lib/adba/aniDBAbstracter.py</a>", line 131, in __init__
    self.aid = self.tvDBMap.get_anidb_for_tvdb(self.tvdb_id)
  File "/home/pi/Medusa/<a href="../blob/d8dee4e20b9df4dfb6ae940942970b97518a2d79/lib/adba/aniDBtvDBmaper.py#L38">lib/adba/aniDBtvDBmaper.py</a>", line 38, in get_anidb_for_tvdb
    return self._get_x_for_y(tvdb_id,"tvdbid","anidbid")
  File "/home/pi/Medusa/<a href="../blob/d8dee4e20b9df4dfb6ae940942970b97518a2d79/lib/adba/aniDBtvDBmaper.py#L44">lib/adba/aniDBtvDBmaper.py</a>", line 44, in _get_x_for_y
    for anime in self.xmlMap.findall("anime"):
AttributeError: 'NoneType' object has no attribute 'findall'
</pre>
---
_STAFF NOTIFIED_: @pymedusa/support @pymedusa/moderators
### INFO
**Python Version**: `2.7.9 (default, Sep 17 2016, 20:26:04) [GCC 4.9.2]`
**Operating System**: `Linux-4.4.38-v7+-armv7l-with-debian-8.0`
**Locale**: `UTF-8`
**Branch**: [develop](../tree/develop)
**Database**: `44.5`
**Commit**: pymedusa/Medusa@d8dee4e20b9df4dfb6ae940942970b97518a2d79
**Link to Log**: https://gist.github.com/9b7383c251d858be85f414b810edab42
### ERROR
<pre>
2017-03-01 11:04:42 ERROR    SEARCHQUEUE-BACKLOG-256115 :: [d8dee4e] Checking AniDB scene exceptions update failed for Billboard Music Awards. Error: 'NoneType' object has no attribute 'findall'
Traceback (most recent call last):
  File "/home/pi/Medusa/<a href="../blob/d8dee4e20b9df4dfb6ae940942970b97518a2d79/medusa/scene_exceptions.py#L409">medusa/scene_exceptions.py</a>", line 409, in _get_anidb_exceptions
    autoCorrectName=True
  File "/home/pi/Medusa/<a href="../blob/d8dee4e20b9df4dfb6ae940942970b97518a2d79/lib/adba/aniDBAbstracter.py#L131">lib/adba/aniDBAbstracter.py</a>", line 131, in __init__
    self.aid = self.tvDBMap.get_anidb_for_tvdb(self.tvdb_id)
  File "/home/pi/Medusa/<a href="../blob/d8dee4e20b9df4dfb6ae940942970b97518a2d79/lib/adba/aniDBtvDBmaper.py#L38">lib/adba/aniDBtvDBmaper.py</a>", line 38, in get_anidb_for_tvdb
    return self._get_x_for_y(tvdb_id,"tvdbid","anidbid")
  File "/home/pi/Medusa/<a href="../blob/d8dee4e20b9df4dfb6ae940942970b97518a2d79/lib/adba/aniDBtvDBmaper.py#L44">lib/adba/aniDBtvDBmaper.py</a>", line 44, in _get_x_for_y
    for anime in self.xmlMap.findall("anime"):
AttributeError: 'NoneType' object has no attribute 'findall'
</pre>
---
_STAFF NOTIFIED_: @pymedusa/support @pymedusa/moderators
@p0psicles need a fix in adba lib right?
More like a refactor
yeah but for now we can check `self.xmlMap` before call findall right?
### INFO
**Python Version**: `2.7.9 (default, Sep 17 2016, 20:26:04) [GCC 4.9.2]`
**Operating System**: `Linux-4.4.38-v7+-armv7l-with-debian-8.0`
**Locale**: `UTF-8`
**Branch**: [develop](../tree/develop)
**Database**: `44.8`
**Commit**: pymedusa/Medusa@ebdacab6f3da657d4069f9e4a391ad00595087f6
**Link to Log**: https://gist.github.com/a3364df9e152e0695760ba9a87ec732b
### ERROR
<pre>
2017-05-23 03:48:19 ERROR    SEARCHQUEUE-DAILY-SEARCH :: [LimeTorrents] :: [ebdacab] Failed parsing publishing date.
Traceback (most recent call last):
  File "/home/pi/Medusa/<a href="../blob/ebdacab6f3da657d4069f9e4a391ad00595087f6/medusa/providers/generic_provider.py#L499">medusa/providers/generic_provider.py</a>", line 499, in parse_pubdate
    seconds = parse(match.group('time'))
AttributeError: 'NoneType' object has no attribute 'group'
</pre>
---
_STAFF NOTIFIED_: @pymedusa/support @pymedusa/moderators
That's by design. @medariox maybe we should also log the date that it's trying to parse?
Yes, the plan was to have an exception so that it can be fixed. I will include the date to the traceback.
### INFO
**Python Version**: `2.7.13 (v2.7.13:a06454b1afa1, Dec 17 2016, 20:53:40) [MSC v.1500 64 bit (AMD64)]`
**Operating System**: `Windows-10-10.0.15063`
**Locale**: `cp1252`
**Branch**: [develop](../tree/develop)
**Database**: `44.8`
**Commit**: pymedusa/Medusa@a47fc33aeee33f6f1cf76c2c76b36e16407e1c93
**Link to Log**: https://gist.github.com/b117254331cacfee323854febaf72740
### ERROR
<pre>
2017-06-22 09:47:28 ERROR    SEARCHQUEUE-MANUAL-325623 :: [Zooqle] :: [a47fc33] Failed parsing publishing date: yesterday
Traceback (most recent call last):
  File "C:\Medusa\medusa\providers\generic_provider.py", line 516, in parse_pubdate
    seconds = parse(match.group('time'))
AttributeError: 'NoneType' object has no attribute 'group'
</pre>
---
_STAFF NOTIFIED_: @pymedusa/support @pymedusa/moderators
### INFO
**Python Version**: `2.7.9 (default, Sep 17 2016, 20:26:04) [GCC 4.9.2]`
**Operating System**: `Linux-4.9.28-v7+-armv7l-with-debian-8.0`
**Locale**: `UTF-8`
**Branch**: [develop](../tree/develop)
**Database**: `44.8`
**Commit**: pymedusa/Medusa@125263e6d8800e27061514e2e43289f3170b5db8
**Link to Log**: https://gist.github.com/fdfb38cfbdb45b872edcdbc4975c9c36
### ERROR
<pre>
2017-07-15 23:04:16 ERROR    SNATCHQUEUE-MANUALSNATCH-308576 :: [125263e] Unknown exception while downloading file /home/pi/torrents/Supercar.Megabuild.S02E08.Lamborghini.Transporter.1080P.HDTV.x264-skorpion.mp4.torrent from URL: https://asnet.pw/download/DA54AE193163BE699B248138B423E01F43E60896/. Error: 'NoneType' object has no attribute 'close'
Traceback (most recent call last):
  File "/home/pi/Medusa/<a href="../blob/125263e6d8800e27061514e2e43289f3170b5db8/medusa/helpers/__init__.py#L1315">medusa/helpers/__init__.py</a>", line 1315, in download_file
    return False
  File "/home/pi/Medusa/<a href="../blob/125263e6d8800e27061514e2e43289f3170b5db8/lib/contextlib2.py#L179">lib/contextlib2.py</a>", line 179, in __exit__
    self.thing.close()
AttributeError: 'NoneType' object has no attribute 'close'
</pre>
---
_STAFF NOTIFIED_: @pymedusa/support @pymedusa/moderators
Aah this is a sneaky one. The 

```python
        with closing(session.get(url, allow_redirects=True, stream=True,
                                 verify=verify, headers=headers, cookies=cookies,
                                 hooks=hooks, proxies=proxies)) as resp:
```
expects a session to close. But the session is passed on from the providers session. Which is a save session. In case of an exception, it will return None in stead of the session object, and there is nothing left to close.
Any ideas on how to handle this? I'm not particular a fan of the context handler here. And passing the session is also not something I would have chosen for myself.
Don't return None on exception and catch the exception instead.
Can't do that, as it's getting the MedusaSafeSession passed from the providers. And that returns None, if it doesn't have a response object.
### INFO
**Python Version**: `2.7.13 (default, Jul 13 2017, 01:16:59) [GCC 4.2.1 Compatible FreeBSD Clang 3.8.0 (tags/RELEASE_380/final 262564)]`
**Operating System**: `FreeBSD-11.0-STABLE-amd64-64bit-ELF`
**Locale**: `None`
**Branch**: [master](../tree/master)
**Database**: `44.8`
**Commit**: pymedusa/Medusa@6b7e935af14dc51e213d7c3449048bc40126292d
**Link to Log**: https://gist.github.com/75417185955b3fb48c1205934949c6bf
### ERROR
<pre>
2017-07-17 15:43:35 ERROR    SHOWQUEUE-REFRESH :: [6b7e935] 31917: Error while refreshing show Pretty Little Liars. Error: 'NoneType' object has no attribute 'get'
Traceback (most recent call last):
  File "/usr/local/share/www/Medusa/<a href="../blob/6b7e935af14dc51e213d7c3449048bc40126292d/medusa/show_queue.py#L629">medusa/show_queue.py</a>", line 629, in run
    self.show.refresh_dir()
  File "/usr/local/share/www/Medusa/<a href="../blob/6b7e935af14dc51e213d7c3449048bc40126292d/medusa/tv/series.py#L1725">medusa/tv/series.py</a>", line 1725, in refresh_dir
    self.load_episodes_from_dir()
  File "/usr/local/share/www/Medusa/<a href="../blob/6b7e935af14dc51e213d7c3449048bc40126292d/medusa/tv/series.py#L919">medusa/tv/series.py</a>", line 919, in load_episodes_from_dir
    cur_episode = self.make_ep_from_file(os.path.join(self.location, media_file))
  File "/usr/local/share/www/Medusa/<a href="../blob/6b7e935af14dc51e213d7c3449048bc40126292d/medusa/tv/series.py#L1345">medusa/tv/series.py</a>", line 1345, in make_ep_from_file
    filepath)
  File "/usr/local/share/www/Medusa/<a href="../blob/6b7e935af14dc51e213d7c3449048bc40126292d/medusa/tv/series.py#L1214">medusa/tv/series.py</a>", line 1214, in should_refresh_file
    new_quality = Quality.name_quality(filepath, anime)
  File "/usr/local/share/www/Medusa/<a href="../blob/6b7e935af14dc51e213d7c3449048bc40126292d/medusa/common.py#L302">medusa/common.py</a>", line 302, in name_quality
    return Quality._extend_quality(name)
  File "/usr/local/share/www/Medusa/<a href="../blob/6b7e935af14dc51e213d7c3449048bc40126292d/medusa/common.py#L401">medusa/common.py</a>", line 401, in _extend_quality
    quality = Quality.quality_from_file_meta(file_path)
  File "/usr/local/share/www/Medusa/<a href="../blob/6b7e935af14dc51e213d7c3449048bc40126292d/medusa/common.py#L422">medusa/common.py</a>", line 422, in quality_from_file_meta
    knowledge = knowit.know(file_path)
  File "/usr/local/share/www/Medusa/<a href="../blob/6b7e935af14dc51e213d7c3449048bc40126292d/lib/knowit/api.py#L49">lib/knowit/api.py</a>", line 49, in know
    return provider.describe(video_path, context)
  File "/usr/local/share/www/Medusa/<a href="../blob/6b7e935af14dc51e213d7c3449048bc40126292d/lib/knowit/providers/mediainfo.py#L350">lib/knowit/providers/mediainfo.py</a>", line 350, in describe
    video_tracks, audio_tracks, subtitle_tracks, context)
  File "/usr/local/share/www/Medusa/<a href="../blob/6b7e935af14dc51e213d7c3449048bc40126292d/lib/knowit/provider.py#L35">lib/knowit/provider.py</a>", line 35, in _describe_tracks
    props = self._describe_track(general_track, 'general', context)
  File "/usr/local/share/www/Medusa/<a href="../blob/6b7e935af14dc51e213d7c3449048bc40126292d/lib/knowit/provider.py#L72">lib/knowit/provider.py</a>", line 72, in _describe_track
    value = prop.extract_value(track, context)
  File "/usr/local/share/www/Medusa/<a href="../blob/6b7e935af14dc51e213d7c3449048bc40126292d/lib/knowit/property.py#L33">lib/knowit/property.py</a>", line 33, in extract_value
    value = track.get(names[0], {}).get(names[1]) if len(names) == 2 else track.get(self.name)
AttributeError: 'NoneType' object has no attribute 'get'
</pre>
---
_STAFF NOTIFIED_: @pymedusa/support @pymedusa/moderators
### INFO
**Python Version**: `2.7.13 (default, Jul 13 2017, 01:16:59) [GCC 4.2.1 Compatible FreeBSD Clang 3.8.0 (tags/RELEASE_380/final 262564)]`
**Operating System**: `FreeBSD-11.0-STABLE-amd64-64bit-ELF`
**Locale**: `None`
**Branch**: [master](../tree/master)
**Database**: `44.8`
**Commit**: pymedusa/Medusa@6b7e935af14dc51e213d7c3449048bc40126292d
**Link to Log**: https://gist.github.com/b0ec24a07cb258c80395bb01767cf6d2
### ERROR
<pre>
2017-07-17 15:41:48 ERROR    SHOWQUEUE-ADD :: [6b7e935] Error searching dir for episodes: 'NoneType' object has no attribute 'get'
Traceback (most recent call last):
  File "/usr/local/share/www/Medusa/<a href="../blob/6b7e935af14dc51e213d7c3449048bc40126292d/medusa/show_queue.py#L562">medusa/show_queue.py</a>", line 562, in run
    self.show.load_episodes_from_dir()
  File "/usr/local/share/www/Medusa/<a href="../blob/6b7e935af14dc51e213d7c3449048bc40126292d/medusa/tv/series.py#L919">medusa/tv/series.py</a>", line 919, in load_episodes_from_dir
    cur_episode = self.make_ep_from_file(os.path.join(self.location, media_file))
  File "/usr/local/share/www/Medusa/<a href="../blob/6b7e935af14dc51e213d7c3449048bc40126292d/medusa/tv/series.py#L1345">medusa/tv/series.py</a>", line 1345, in make_ep_from_file
    filepath)
  File "/usr/local/share/www/Medusa/<a href="../blob/6b7e935af14dc51e213d7c3449048bc40126292d/medusa/tv/series.py#L1214">medusa/tv/series.py</a>", line 1214, in should_refresh_file
    new_quality = Quality.name_quality(filepath, anime)
  File "/usr/local/share/www/Medusa/<a href="../blob/6b7e935af14dc51e213d7c3449048bc40126292d/medusa/common.py#L302">medusa/common.py</a>", line 302, in name_quality
    return Quality._extend_quality(name)
  File "/usr/local/share/www/Medusa/<a href="../blob/6b7e935af14dc51e213d7c3449048bc40126292d/medusa/common.py#L401">medusa/common.py</a>", line 401, in _extend_quality
    quality = Quality.quality_from_file_meta(file_path)
  File "/usr/local/share/www/Medusa/<a href="../blob/6b7e935af14dc51e213d7c3449048bc40126292d/medusa/common.py#L422">medusa/common.py</a>", line 422, in quality_from_file_meta
    knowledge = knowit.know(file_path)
  File "/usr/local/share/www/Medusa/<a href="../blob/6b7e935af14dc51e213d7c3449048bc40126292d/lib/knowit/api.py#L49">lib/knowit/api.py</a>", line 49, in know
    return provider.describe(video_path, context)
  File "/usr/local/share/www/Medusa/<a href="../blob/6b7e935af14dc51e213d7c3449048bc40126292d/lib/knowit/providers/mediainfo.py#L350">lib/knowit/providers/mediainfo.py</a>", line 350, in describe
    video_tracks, audio_tracks, subtitle_tracks, context)
  File "/usr/local/share/www/Medusa/<a href="../blob/6b7e935af14dc51e213d7c3449048bc40126292d/lib/knowit/provider.py#L35">lib/knowit/provider.py</a>", line 35, in _describe_tracks
    props = self._describe_track(general_track, 'general', context)
  File "/usr/local/share/www/Medusa/<a href="../blob/6b7e935af14dc51e213d7c3449048bc40126292d/lib/knowit/provider.py#L72">lib/knowit/provider.py</a>", line 72, in _describe_track
    value = prop.extract_value(track, context)
  File "/usr/local/share/www/Medusa/<a href="../blob/6b7e935af14dc51e213d7c3449048bc40126292d/lib/knowit/property.py#L33">lib/knowit/property.py</a>", line 33, in extract_value
    value = track.get(names[0], {}).get(names[1]) if len(names) == 2 else track.get(self.name)
AttributeError: 'NoneType' object has no attribute 'get'
</pre>
---
_STAFF NOTIFIED_: @pymedusa/support @pymedusa/moderators
Ping @ratoaq2 ^ (different issue, related to knowit)
Better to report it separately so it won't be missed 
### INFO
**Python Version**: `2.7.12 (v2.7.12:d33e0cf91556, Jun 27 2016, 15:24:40) [MSC v.1500 64 bit (AMD64)]`
**Operating System**: `Windows-10-10.0.15063`
**Locale**: `cp1252`
**Branch**: [develop](../tree/develop)
**Database**: `44.8`
**Commit**: pymedusa/Medusa@647d47d571787862d056e80432757d1e026a0198
**Link to Log**: https://gist.github.com/6c11971edc24684ec3dfbefeb8b06246
### ERROR
<pre>
2017-08-06 17:27:43 ERROR    SHOWQUEUE-ADD :: [647d47d] Error loading IMDb info: 'NoneType' object has no attribute 'year'
Traceback (most recent call last):
  File "C:\Medusa\medusa\show_queue.py", line 533, in run
    self.show.load_imdb_info()
  File "C:\Medusa\medusa\tv\series.py", line 1552, in load_imdb_info
    if not imdb_obj.year:
AttributeError: 'NoneType' object has no attribute 'year'
</pre>
---
_STAFF NOTIFIED_: @pymedusa/support @pymedusa/moderators
@medariox last report was fixed? If yes I will rename the issue title to avoid adding stuff here
### INFO
**Python Version**: `2.7.9 (default, Sep 17 2016, 20:26:04) [GCC 4.9.2]`
**Operating System**: `Linux-4.9.35-v7+-armv7l-with-debian-8.0`
**Locale**: `UTF-8`
**Branch**: [develop](../tree/develop)
**Database**: `44.8`
**Commit**: pymedusa/Medusa@75951e66ac8af38bad7f545095bf61c34c9e65d3
**Link to Log**: https://gist.github.com/3077a2a730cbe70900aaf110a047d601
### ERROR
<pre>
2017-10-24 13:00:41 ERROR    SEARCHQUEUE-DAILY-SEARCH :: [Torrenting] :: [75951e6] DailySearchQueueItem Exception, error: 'NoneType' object has no attribute 'text'
Traceback (most recent call last):
  File "/home/pi/Medusa/<a href="../blob/75951e66ac8af38bad7f545095bf61c34c9e65d3/medusa/search/queue.py#L262">medusa/search/queue.py</a>", line 262, in run
    found_results = search_for_needed_episodes(force=self.force)
  File "/home/pi/Medusa/<a href="../blob/75951e66ac8af38bad7f545095bf61c34c9e65d3/medusa/search/core.py#L444">medusa/search/core.py</a>", line 444, in search_for_needed_episodes
    cur_provider.cache.update_cache()
  File "/home/pi/Medusa/<a href="../blob/75951e66ac8af38bad7f545095bf61c34c9e65d3/medusa/tv/cache.py#L196">medusa/tv/cache.py</a>", line 196, in update_cache
    data = self._get_rss_data()
  File "/home/pi/Medusa/<a href="../blob/75951e66ac8af38bad7f545095bf61c34c9e65d3/medusa/tv/cache.py#L179">medusa/tv/cache.py</a>", line 179, in _get_rss_data
    return {'entries': self.provider.search(self.search_params)}
  File "/home/pi/Medusa/<a href="../blob/75951e66ac8af38bad7f545095bf61c34c9e65d3/medusa/providers/torrent/html/torrenting.py#L63">medusa/providers/torrent/html/torrenting.py</a>", line 63, in search
    if not self.login():
  File "/home/pi/Medusa/<a href="../blob/75951e66ac8af38bad7f545095bf61c34c9e65d3/medusa/providers/torrent/html/torrenting.py#L162">medusa/providers/torrent/html/torrenting.py</a>", line 162, in login
    return self.cookie_login('sign in')
  File "/home/pi/Medusa/<a href="../blob/75951e66ac8af38bad7f545095bf61c34c9e65d3/medusa/providers/generic_provider.py#L846">medusa/providers/generic_provider.py</a>", line 846, in cookie_login
    not (response.text and response.status_code == 200),
AttributeError: 'NoneType' object has no attribute 'text'
</pre>
---
_STAFF NOTIFIED_: @pymedusa/support @pymedusa/moderators

Resolving patch:
diff --git a/medusa/providers/generic_provider.py b/medusa/providers/generic_provider.py
--- a/medusa/providers/generic_provider.py
+++ b/medusa/providers/generic_provider.py
@@ -842,9 +842,8 @@ def cookie_login(self, check_login_text, check_url=None):
             return False
 
         response = self.session.get(check_url)
-        if any([not response,
-                not (response.text and response.status_code == 200),
-                check_login_text.lower() in response.text.lower()]):
+        if not response or any([not (response.text and response.status_code == 200),
+                                check_login_text.lower() in response.text.lower()]):
             log.warning('Please configure the required cookies for this provider. Check your provider settings')
             ui.notifications.error('Wrong cookies for {provider}'.format(provider=self.name),
                                    'Check your provider settings')


Test patch: