prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  Login error
  ```
  Error
  unhashable type: 'list'
  Traceback
  Traceback (most recent call last): 
  File "/home/pi/Medusa/ext/tornado/web.py", line 1509, in _execute result = method(*self.path_args, **self.path_kwargs) 
  File "/home/pi/Medusa/medusa/server/web/core/authentication.py", line 73, in post notifiers.notify_login(self.request.remote_ip) 
  File "/home/pi/Medusa/medusa/notifiers/__init__.py", line 127, in notify_login n.notify_login(ipaddress)
  File "/home/pi/Medusa/medusa/notifiers/nma.py", line 44, in notify_login self._sendNMA(nma_api=None, nma_priority=None, event=title, message=update_text.format(ipaddress)) 
  File "/home/pi/Medusa/medusa/notifiers/nma.py", line 74, in _sendNMA if not response[nma_api][u'code'] == u'200': 
  TypeError: unhashable type: 'list' 
  Request Info
  body: username=supergonkas&password=&remember_me=1&submit=Login
  files: {}
  protocol: http
  connection: 
  body_arguments: {'username': ['supergonkas'], 'remember_me': ['1'], 'password': [''], 'submit': ['Login']}
  uri: /login/?next=%2Fhistory%2F
  query_arguments: {'next': ['/history/']}
  _start_time: 1505997382.06
  headers: Origin: http://:8081 Save-Data: on Content-Length: 61 Accept-Language: pt-PT,pt;q=0.8,en-US;q=0.6,en;q=0.4,es;q=0.2 Accept-Encoding: gzip, deflate Connection: keep-alive Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8 Upgrade-Insecure-Requests: 1 Dnt: 1 Host::8081 Referer: http://:8081/login/?next=%2Fhistory%2F Cache-Control: max-age=0 User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.116 Safari/537.36 Content-Type: application/x-www-form-urlencoded 
  host: :8081
  version: HTTP/1.1
  server_connection: 
  host_name: s
  _finish_time: None
  query: next=%2Fhistory%2F
  arguments: {'username': ['supergonkas'], 'remember_me': ['1'], 'password': [''], 'submit': ['Login'], 'next': ['/history/']}
  path: /login/
  method: POST
  remote_ip: 194.210.190.12
  View Log(Errors)
  ```
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `medusa/notifiers/nma.py`
  Content:
  ```
  1 # coding=utf-8
  2 
  3 import logging
  4 
  5 from medusa import app, common
  6 from medusa.logger.adapters.style import BraceAdapter
  7 
  8 from pynma import pynma
  9 
  10 log = BraceAdapter(logging.getLogger(__name__))
  11 log.logger.addHandler(logging.NullHandler())
  12 
  13 
  14 class Notifier(object):
  15     def test_notify(self, nma_api, nma_priority):
  16         return self._sendNMA(nma_api, nma_priority, event='Test', message='Testing NMA settings from Medusa',
  17                              force=True)
  18 
  19     def notify_snatch(self, ep_name, is_proper):
  20         if app.NMA_NOTIFY_ONSNATCH:
  21             self._sendNMA(nma_api=None, nma_priority=None, event=common.notifyStrings[(common.NOTIFY_SNATCH, common.NOTIFY_SNATCH_PROPER)[is_proper]],
  22                           message=ep_name)
  23 
  24     def notify_download(self, ep_name):
  25         if app.NMA_NOTIFY_ONDOWNLOAD:
  26             self._sendNMA(nma_api=None, nma_priority=None, event=common.notifyStrings[common.NOTIFY_DOWNLOAD],
  27                           message=ep_name)
  28 
  29     def notify_subtitle_download(self, ep_name, lang):
  30         if app.NMA_NOTIFY_ONSUBTITLEDOWNLOAD:
  31             self._sendNMA(nma_api=None, nma_priority=None, event=common.notifyStrings[common.NOTIFY_SUBTITLE_DOWNLOAD],
  32                           message=ep_name + ': ' + lang)
  33 
  34     def notify_git_update(self, new_version='??'):
  35         if app.USE_NMA:
  36             update_text = common.notifyStrings[common.NOTIFY_GIT_UPDATE_TEXT]
  37             title = common.notifyStrings[common.NOTIFY_GIT_UPDATE]
  38             self._sendNMA(nma_api=None, nma_priority=None, event=title, message=update_text + new_version)
  39 
  40     def notify_login(self, ipaddress=''):
  41         if app.USE_NMA:
  42             update_text = common.notifyStrings[common.NOTIFY_LOGIN_TEXT]
  43             title = common.notifyStrings[common.NOTIFY_LOGIN]
  44             self._sendNMA(nma_api=None, nma_priority=None, event=title, message=update_text.format(ipaddress))
  45 
  46     def _sendNMA(self, nma_api=None, nma_priority=None, event=None, message=None, force=False):
  47 
  48         title = 'Medusa'
  49 
  50         if not app.USE_NMA and not force:
  51             return False
  52 
  53         if nma_api is None:
  54             nma_api = app.NMA_API
  55         else:
  56             nma_api = nma_api.split(',')
  57 
  58         if nma_priority is None:
  59             nma_priority = app.NMA_PRIORITY
  60 
  61         batch = False
  62 
  63         p = pynma.PyNMA()
  64         keys = nma_api
  65         p.addkey(keys)
  66 
  67         if len(keys) > 1:
  68             batch = True
  69 
  70         log.debug(u'NMA: Sending notice with details: event="{0}, message="{1}", priority={2}, batch={3}',
  71                   event, message, nma_priority, batch)
  72         response = p.push(application=title, event=event, description=message, priority=nma_priority, batch_mode=batch)
  73 
  74         if not response[nma_api][u'code'] == u'200':
  75             log.error(u'Could not send notification to NotifyMyAndroid')
  76             return False
  77         else:
  78             log.info(u'NMA: Notification sent to NotifyMyAndroid')
  79             return True
  80
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/medusa/notifiers/nma.py b/medusa/notifiers/nma.py
  --- a/medusa/notifiers/nma.py
  +++ b/medusa/notifiers/nma.py
  @@ -4,8 +4,8 @@
   
   from medusa import app, common
   from medusa.logger.adapters.style import BraceAdapter
  -
   from pynma import pynma
  +from six import text_type
   
   log = BraceAdapter(logging.getLogger(__name__))
   log.logger.addHandler(logging.NullHandler())
  @@ -52,8 +52,8 @@
   
           if nma_api is None:
               nma_api = app.NMA_API
  -        else:
  -            nma_api = nma_api.split(',')
  +        elif isinstance(nma_api, text_type):
  +            nma_api = [nma_api]
   
           if nma_priority is None:
               nma_priority = app.NMA_PRIORITY
  @@ -71,7 +71,7 @@
                     event, message, nma_priority, batch)
           response = p.push(application=title, event=event, description=message, priority=nma_priority, batch_mode=batch)
   
  -        if not response[nma_api][u'code'] == u'200':
  +        if not response[','.join(nma_api)][u'code'] == u'200':
               log.error(u'Could not send notification to NotifyMyAndroid')
               return False
           else:
  
verification_info: {"golden_diff": "diff --git a/medusa/notifiers/nma.py b/medusa/notifiers/nma.py\n--- a/medusa/notifiers/nma.py\n+++ b/medusa/notifiers/nma.py\n@@ -4,8 +4,8 @@\n \n from medusa import app, common\n from medusa.logger.adapters.style import BraceAdapter\n-\n from pynma import pynma\n+from six import text_type\n \n log = BraceAdapter(logging.getLogger(__name__))\n log.logger.addHandler(logging.NullHandler())\n@@ -52,8 +52,8 @@\n \n         if nma_api is None:\n             nma_api = app.NMA_API\n-        else:\n-            nma_api = nma_api.split(',')\n+        elif isinstance(nma_api, text_type):\n+            nma_api = [nma_api]\n \n         if nma_priority is None:\n             nma_priority = app.NMA_PRIORITY\n@@ -71,7 +71,7 @@\n                   event, message, nma_priority, batch)\n         response = p.push(application=title, event=event, description=message, priority=nma_priority, batch_mode=batch)\n \n-        if not response[nma_api][u'code'] == u'200':\n+        if not response[','.join(nma_api)][u'code'] == u'200':\n             log.error(u'Could not send notification to NotifyMyAndroid')\n             return False\n         else:\n", "issue": "Login error\n```\r\nError\r\nunhashable type: 'list'\r\nTraceback\r\nTraceback (most recent call last): \r\nFile \"/home/pi/Medusa/ext/tornado/web.py\", line 1509, in _execute result = method(*self.path_args, **self.path_kwargs) \r\nFile \"/home/pi/Medusa/medusa/server/web/core/authentication.py\", line 73, in post notifiers.notify_login(self.request.remote_ip) \r\nFile \"/home/pi/Medusa/medusa/notifiers/__init__.py\", line 127, in notify_login n.notify_login(ipaddress)\r\nFile \"/home/pi/Medusa/medusa/notifiers/nma.py\", line 44, in notify_login self._sendNMA(nma_api=None, nma_priority=None, event=title, message=update_text.format(ipaddress)) \r\nFile \"/home/pi/Medusa/medusa/notifiers/nma.py\", line 74, in _sendNMA if not response[nma_api][u'code'] == u'200': \r\nTypeError: unhashable type: 'list' \r\nRequest Info\r\nbody: username=supergonkas&password=&remember_me=1&submit=Login\r\nfiles: {}\r\nprotocol: http\r\nconnection: \r\nbody_arguments: {'username': ['supergonkas'], 'remember_me': ['1'], 'password': [''], 'submit': ['Login']}\r\nuri: /login/?next=%2Fhistory%2F\r\nquery_arguments: {'next': ['/history/']}\r\n_start_time: 1505997382.06\r\nheaders: Origin: http://:8081 Save-Data: on Content-Length: 61 Accept-Language: pt-PT,pt;q=0.8,en-US;q=0.6,en;q=0.4,es;q=0.2 Accept-Encoding: gzip, deflate Connection: keep-alive Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8 Upgrade-Insecure-Requests: 1 Dnt: 1 Host::8081 Referer: http://:8081/login/?next=%2Fhistory%2F Cache-Control: max-age=0 User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.116 Safari/537.36 Content-Type: application/x-www-form-urlencoded \r\nhost: :8081\r\nversion: HTTP/1.1\r\nserver_connection: \r\nhost_name: s\r\n_finish_time: None\r\nquery: next=%2Fhistory%2F\r\narguments: {'username': ['supergonkas'], 'remember_me': ['1'], 'password': [''], 'submit': ['Login'], 'next': ['/history/']}\r\npath: /login/\r\nmethod: POST\r\nremote_ip: 194.210.190.12\r\nView Log(Errors)\r\n```\n", "before_files": [{"content": "# coding=utf-8\n\nimport logging\n\nfrom medusa import app, common\nfrom medusa.logger.adapters.style import BraceAdapter\n\nfrom pynma import pynma\n\nlog = BraceAdapter(logging.getLogger(__name__))\nlog.logger.addHandler(logging.NullHandler())\n\n\nclass Notifier(object):\n    def test_notify(self, nma_api, nma_priority):\n        return self._sendNMA(nma_api, nma_priority, event='Test', message='Testing NMA settings from Medusa',\n                             force=True)\n\n    def notify_snatch(self, ep_name, is_proper):\n        if app.NMA_NOTIFY_ONSNATCH:\n            self._sendNMA(nma_api=None, nma_priority=None, event=common.notifyStrings[(common.NOTIFY_SNATCH, common.NOTIFY_SNATCH_PROPER)[is_proper]],\n                          message=ep_name)\n\n    def notify_download(self, ep_name):\n        if app.NMA_NOTIFY_ONDOWNLOAD:\n            self._sendNMA(nma_api=None, nma_priority=None, event=common.notifyStrings[common.NOTIFY_DOWNLOAD],\n                          message=ep_name)\n\n    def notify_subtitle_download(self, ep_name, lang):\n        if app.NMA_NOTIFY_ONSUBTITLEDOWNLOAD:\n            self._sendNMA(nma_api=None, nma_priority=None, event=common.notifyStrings[common.NOTIFY_SUBTITLE_DOWNLOAD],\n                          message=ep_name + ': ' + lang)\n\n    def notify_git_update(self, new_version='??'):\n        if app.USE_NMA:\n            update_text = common.notifyStrings[common.NOTIFY_GIT_UPDATE_TEXT]\n            title = common.notifyStrings[common.NOTIFY_GIT_UPDATE]\n            self._sendNMA(nma_api=None, nma_priority=None, event=title, message=update_text + new_version)\n\n    def notify_login(self, ipaddress=''):\n        if app.USE_NMA:\n            update_text = common.notifyStrings[common.NOTIFY_LOGIN_TEXT]\n            title = common.notifyStrings[common.NOTIFY_LOGIN]\n            self._sendNMA(nma_api=None, nma_priority=None, event=title, message=update_text.format(ipaddress))\n\n    def _sendNMA(self, nma_api=None, nma_priority=None, event=None, message=None, force=False):\n\n        title = 'Medusa'\n\n        if not app.USE_NMA and not force:\n            return False\n\n        if nma_api is None:\n            nma_api = app.NMA_API\n        else:\n            nma_api = nma_api.split(',')\n\n        if nma_priority is None:\n            nma_priority = app.NMA_PRIORITY\n\n        batch = False\n\n        p = pynma.PyNMA()\n        keys = nma_api\n        p.addkey(keys)\n\n        if len(keys) > 1:\n            batch = True\n\n        log.debug(u'NMA: Sending notice with details: event=\"{0}, message=\"{1}\", priority={2}, batch={3}',\n                  event, message, nma_priority, batch)\n        response = p.push(application=title, event=event, description=message, priority=nma_priority, batch_mode=batch)\n\n        if not response[nma_api][u'code'] == u'200':\n            log.error(u'Could not send notification to NotifyMyAndroid')\n            return False\n        else:\n            log.info(u'NMA: Notification sent to NotifyMyAndroid')\n            return True\n", "path": "medusa/notifiers/nma.py"}], "after_files": [{"content": "# coding=utf-8\n\nimport logging\n\nfrom medusa import app, common\nfrom medusa.logger.adapters.style import BraceAdapter\nfrom pynma import pynma\nfrom six import text_type\n\nlog = BraceAdapter(logging.getLogger(__name__))\nlog.logger.addHandler(logging.NullHandler())\n\n\nclass Notifier(object):\n    def test_notify(self, nma_api, nma_priority):\n        return self._sendNMA(nma_api, nma_priority, event='Test', message='Testing NMA settings from Medusa',\n                             force=True)\n\n    def notify_snatch(self, ep_name, is_proper):\n        if app.NMA_NOTIFY_ONSNATCH:\n            self._sendNMA(nma_api=None, nma_priority=None, event=common.notifyStrings[(common.NOTIFY_SNATCH, common.NOTIFY_SNATCH_PROPER)[is_proper]],\n                          message=ep_name)\n\n    def notify_download(self, ep_name):\n        if app.NMA_NOTIFY_ONDOWNLOAD:\n            self._sendNMA(nma_api=None, nma_priority=None, event=common.notifyStrings[common.NOTIFY_DOWNLOAD],\n                          message=ep_name)\n\n    def notify_subtitle_download(self, ep_name, lang):\n        if app.NMA_NOTIFY_ONSUBTITLEDOWNLOAD:\n            self._sendNMA(nma_api=None, nma_priority=None, event=common.notifyStrings[common.NOTIFY_SUBTITLE_DOWNLOAD],\n                          message=ep_name + ': ' + lang)\n\n    def notify_git_update(self, new_version='??'):\n        if app.USE_NMA:\n            update_text = common.notifyStrings[common.NOTIFY_GIT_UPDATE_TEXT]\n            title = common.notifyStrings[common.NOTIFY_GIT_UPDATE]\n            self._sendNMA(nma_api=None, nma_priority=None, event=title, message=update_text + new_version)\n\n    def notify_login(self, ipaddress=''):\n        if app.USE_NMA:\n            update_text = common.notifyStrings[common.NOTIFY_LOGIN_TEXT]\n            title = common.notifyStrings[common.NOTIFY_LOGIN]\n            self._sendNMA(nma_api=None, nma_priority=None, event=title, message=update_text.format(ipaddress))\n\n    def _sendNMA(self, nma_api=None, nma_priority=None, event=None, message=None, force=False):\n\n        title = 'Medusa'\n\n        if not app.USE_NMA and not force:\n            return False\n\n        if nma_api is None:\n            nma_api = app.NMA_API\n        elif isinstance(nma_api, text_type):\n            nma_api = [nma_api]\n\n        if nma_priority is None:\n            nma_priority = app.NMA_PRIORITY\n\n        batch = False\n\n        p = pynma.PyNMA()\n        keys = nma_api\n        p.addkey(keys)\n\n        if len(keys) > 1:\n            batch = True\n\n        log.debug(u'NMA: Sending notice with details: event=\"{0}, message=\"{1}\", priority={2}, batch={3}',\n                  event, message, nma_priority, batch)\n        response = p.push(application=title, event=event, description=message, priority=nma_priority, batch_mode=batch)\n\n        if not response[','.join(nma_api)][u'code'] == u'200':\n            log.error(u'Could not send notification to NotifyMyAndroid')\n            return False\n        else:\n            log.info(u'NMA: Notification sent to NotifyMyAndroid')\n            return True\n", "path": "medusa/notifiers/nma.py"}]}