prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  premiumize.me hook is broken
  account says username and password is ok
  
  but the log always shows:
  
  4   01.08.2015 19:50:13 WARNING HOOK PremiumizeMe: 'password' | Waiting 1 minute and retry
  5   01.08.2015 19:51:05 WARNING HOOK PremiumizeMe: 'password' | Waiting 1 minute and retry
  6   01.08.2015 19:51:13 WARNING HOOK PremiumizeMe: 'password' | Waiting 1 minute and retry
  7   01.08.2015 19:52:05 WARNING HOOK PremiumizeMe: 'password' | Waiting 1 minute and retry
  8   01.08.2015 19:52:13 WARNING HOOK PremiumizeMe: 'password' | Waiting 1 minute and retry
  9   01.08.2015 19:53:05 WARNING HOOK PremiumizeMe: 'password' | Waiting 1 minute and retry
  10  01.08.2015 19:53:13 WARNING HOOK PremiumizeMe: 'password' | Waiting 1 minute and retry
  
  so i guess the hook is broken
  
  premiumize.me hook is broken
  account says username and password is ok
  
  but the log always shows:
  
  4   01.08.2015 19:50:13 WARNING HOOK PremiumizeMe: 'password' | Waiting 1 minute and retry
  5   01.08.2015 19:51:05 WARNING HOOK PremiumizeMe: 'password' | Waiting 1 minute and retry
  6   01.08.2015 19:51:13 WARNING HOOK PremiumizeMe: 'password' | Waiting 1 minute and retry
  7   01.08.2015 19:52:05 WARNING HOOK PremiumizeMe: 'password' | Waiting 1 minute and retry
  8   01.08.2015 19:52:13 WARNING HOOK PremiumizeMe: 'password' | Waiting 1 minute and retry
  9   01.08.2015 19:53:05 WARNING HOOK PremiumizeMe: 'password' | Waiting 1 minute and retry
  10  01.08.2015 19:53:13 WARNING HOOK PremiumizeMe: 'password' | Waiting 1 minute and retry
  
  so i guess the hook is broken
  
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `module/plugins/hoster/PremiumizeMe.py`
  Content:
  ```
  1 # -*- coding: utf-8 -*-
  2 
  3 from module.common.json_layer import json_loads
  4 from module.plugins.internal.MultiHoster import MultiHoster, create_getInfo
  5 
  6 
  7 class PremiumizeMe(MultiHoster):
  8     __name__    = "PremiumizeMe"
  9     __type__    = "hoster"
  10     __version__ = "0.19"
  11     __status__  = "testing"
  12 
  13     __pattern__ = r'^unmatchable$'  #: Since we want to allow the user to specify the list of hoster to use we let MultiHoster.activate
  14     __config__  = [("use_premium" , "bool", "Use premium account if available"    , True),
  15                    ("revertfailed", "bool", "Revert to standard download if fails", True)]
  16 
  17     __description__ = """Premiumize.me multi-hoster plugin"""
  18     __license__     = "GPLv3"
  19     __authors__     = [("Florian Franzen", "FlorianFranzen@gmail.com")]
  20 
  21 
  22     def handle_premium(self, pyfile):
  23         #: In some cases hostsers do not supply us with a filename at download, so we
  24         #: Are going to set a fall back filename (e.g. for freakshare or xfileshare)
  25         pyfile.name = pyfile.name.split('/').pop()  #: Remove everthing before last slash
  26 
  27         #: Correction for automatic assigned filename: Removing html at end if needed
  28         suffix_to_remove = ["html", "htm", "php", "php3", "asp", "shtm", "shtml", "cfml", "cfm"]
  29         temp = pyfile.name.split('.')
  30         if temp.pop() in suffix_to_remove:
  31             pyfile.name = ".".join(temp)
  32 
  33         #: Get account data
  34         user, data = self.account.select()
  35 
  36         #: Get rewritten link using the premiumize.me api v1 (see https://secure.premiumize.me/?show=api)
  37         data = json_loads(self.load("http://api.premiumize.me/pm-api/v1.php",  #@TODO: Revert to `https` in 0.4.10
  38                                     get={'method'       : "directdownloadlink",
  39                                          'params[login]': user,
  40                                          'params[pass]' : data['password'],
  41                                          'params[link]' : pyfile.url}))
  42 
  43         #: Check status and decide what to do
  44         status = data['status']
  45 
  46         if status == 200:
  47             self.link = data['result']['location']
  48             return
  49 
  50         elif status == 400:
  51             self.fail(_("Invalid link"))
  52 
  53         elif status == 404:
  54             self.offline()
  55 
  56         elif status >= 500:
  57             self.temp_offline()
  58 
  59         else:
  60             self.fail(data['statusmessage'])
  61 
  62 
  63 getInfo = create_getInfo(PremiumizeMe)
  64
  ```
  --- 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/module/plugins/hoster/PremiumizeMe.py b/module/plugins/hoster/PremiumizeMe.py
  --- a/module/plugins/hoster/PremiumizeMe.py
  +++ b/module/plugins/hoster/PremiumizeMe.py
  @@ -7,7 +7,7 @@
   class PremiumizeMe(MultiHoster):
       __name__    = "PremiumizeMe"
       __type__    = "hoster"
  -    __version__ = "0.19"
  +    __version__ = "0.20"
       __status__  = "testing"
   
       __pattern__ = r'^unmatchable$'  #: Since we want to allow the user to specify the list of hoster to use we let MultiHoster.activate
  @@ -31,13 +31,13 @@
               pyfile.name = ".".join(temp)
   
           #: Get account data
  -        user, data = self.account.select()
  +        user, info = self.account.select()
   
           #: Get rewritten link using the premiumize.me api v1 (see https://secure.premiumize.me/?show=api)
           data = json_loads(self.load("http://api.premiumize.me/pm-api/v1.php",  #@TODO: Revert to `https` in 0.4.10
                                       get={'method'       : "directdownloadlink",
                                            'params[login]': user,
  -                                         'params[pass]' : data['password'],
  +                                         'params[pass]' : info['login']['password'],
                                            'params[link]' : pyfile.url}))
   
           #: Check status and decide what to do
  
verification_info: {"golden_diff": "diff --git a/module/plugins/hoster/PremiumizeMe.py b/module/plugins/hoster/PremiumizeMe.py\n--- a/module/plugins/hoster/PremiumizeMe.py\n+++ b/module/plugins/hoster/PremiumizeMe.py\n@@ -7,7 +7,7 @@\n class PremiumizeMe(MultiHoster):\n     __name__    = \"PremiumizeMe\"\n     __type__    = \"hoster\"\n-    __version__ = \"0.19\"\n+    __version__ = \"0.20\"\n     __status__  = \"testing\"\n \n     __pattern__ = r'^unmatchable$'  #: Since we want to allow the user to specify the list of hoster to use we let MultiHoster.activate\n@@ -31,13 +31,13 @@\n             pyfile.name = \".\".join(temp)\n \n         #: Get account data\n-        user, data = self.account.select()\n+        user, info = self.account.select()\n \n         #: Get rewritten link using the premiumize.me api v1 (see https://secure.premiumize.me/?show=api)\n         data = json_loads(self.load(\"http://api.premiumize.me/pm-api/v1.php\",  #@TODO: Revert to `https` in 0.4.10\n                                     get={'method'       : \"directdownloadlink\",\n                                          'params[login]': user,\n-                                         'params[pass]' : data['password'],\n+                                         'params[pass]' : info['login']['password'],\n                                          'params[link]' : pyfile.url}))\n \n         #: Check status and decide what to do\n", "issue": "premiumize.me hook is broken\naccount says username and password is ok\n\nbut the log always shows:\n\n4   01.08.2015 19:50:13 WARNING HOOK PremiumizeMe: 'password' | Waiting 1 minute and retry\n5   01.08.2015 19:51:05 WARNING HOOK PremiumizeMe: 'password' | Waiting 1 minute and retry\n6   01.08.2015 19:51:13 WARNING HOOK PremiumizeMe: 'password' | Waiting 1 minute and retry\n7   01.08.2015 19:52:05 WARNING HOOK PremiumizeMe: 'password' | Waiting 1 minute and retry\n8   01.08.2015 19:52:13 WARNING HOOK PremiumizeMe: 'password' | Waiting 1 minute and retry\n9   01.08.2015 19:53:05 WARNING HOOK PremiumizeMe: 'password' | Waiting 1 minute and retry\n10  01.08.2015 19:53:13 WARNING HOOK PremiumizeMe: 'password' | Waiting 1 minute and retry\n\nso i guess the hook is broken\n\npremiumize.me hook is broken\naccount says username and password is ok\n\nbut the log always shows:\n\n4   01.08.2015 19:50:13 WARNING HOOK PremiumizeMe: 'password' | Waiting 1 minute and retry\n5   01.08.2015 19:51:05 WARNING HOOK PremiumizeMe: 'password' | Waiting 1 minute and retry\n6   01.08.2015 19:51:13 WARNING HOOK PremiumizeMe: 'password' | Waiting 1 minute and retry\n7   01.08.2015 19:52:05 WARNING HOOK PremiumizeMe: 'password' | Waiting 1 minute and retry\n8   01.08.2015 19:52:13 WARNING HOOK PremiumizeMe: 'password' | Waiting 1 minute and retry\n9   01.08.2015 19:53:05 WARNING HOOK PremiumizeMe: 'password' | Waiting 1 minute and retry\n10  01.08.2015 19:53:13 WARNING HOOK PremiumizeMe: 'password' | Waiting 1 minute and retry\n\nso i guess the hook is broken\n\n", "before_files": [{"content": "# -*- coding: utf-8 -*-\n\nfrom module.common.json_layer import json_loads\nfrom module.plugins.internal.MultiHoster import MultiHoster, create_getInfo\n\n\nclass PremiumizeMe(MultiHoster):\n    __name__    = \"PremiumizeMe\"\n    __type__    = \"hoster\"\n    __version__ = \"0.19\"\n    __status__  = \"testing\"\n\n    __pattern__ = r'^unmatchable$'  #: Since we want to allow the user to specify the list of hoster to use we let MultiHoster.activate\n    __config__  = [(\"use_premium\" , \"bool\", \"Use premium account if available\"    , True),\n                   (\"revertfailed\", \"bool\", \"Revert to standard download if fails\", True)]\n\n    __description__ = \"\"\"Premiumize.me multi-hoster plugin\"\"\"\n    __license__     = \"GPLv3\"\n    __authors__     = [(\"Florian Franzen\", \"FlorianFranzen@gmail.com\")]\n\n\n    def handle_premium(self, pyfile):\n        #: In some cases hostsers do not supply us with a filename at download, so we\n        #: Are going to set a fall back filename (e.g. for freakshare or xfileshare)\n        pyfile.name = pyfile.name.split('/').pop()  #: Remove everthing before last slash\n\n        #: Correction for automatic assigned filename: Removing html at end if needed\n        suffix_to_remove = [\"html\", \"htm\", \"php\", \"php3\", \"asp\", \"shtm\", \"shtml\", \"cfml\", \"cfm\"]\n        temp = pyfile.name.split('.')\n        if temp.pop() in suffix_to_remove:\n            pyfile.name = \".\".join(temp)\n\n        #: Get account data\n        user, data = self.account.select()\n\n        #: Get rewritten link using the premiumize.me api v1 (see https://secure.premiumize.me/?show=api)\n        data = json_loads(self.load(\"http://api.premiumize.me/pm-api/v1.php\",  #@TODO: Revert to `https` in 0.4.10\n                                    get={'method'       : \"directdownloadlink\",\n                                         'params[login]': user,\n                                         'params[pass]' : data['password'],\n                                         'params[link]' : pyfile.url}))\n\n        #: Check status and decide what to do\n        status = data['status']\n\n        if status == 200:\n            self.link = data['result']['location']\n            return\n\n        elif status == 400:\n            self.fail(_(\"Invalid link\"))\n\n        elif status == 404:\n            self.offline()\n\n        elif status >= 500:\n            self.temp_offline()\n\n        else:\n            self.fail(data['statusmessage'])\n\n\ngetInfo = create_getInfo(PremiumizeMe)\n", "path": "module/plugins/hoster/PremiumizeMe.py"}], "after_files": [{"content": "# -*- coding: utf-8 -*-\n\nfrom module.common.json_layer import json_loads\nfrom module.plugins.internal.MultiHoster import MultiHoster, create_getInfo\n\n\nclass PremiumizeMe(MultiHoster):\n    __name__    = \"PremiumizeMe\"\n    __type__    = \"hoster\"\n    __version__ = \"0.20\"\n    __status__  = \"testing\"\n\n    __pattern__ = r'^unmatchable$'  #: Since we want to allow the user to specify the list of hoster to use we let MultiHoster.activate\n    __config__  = [(\"use_premium\" , \"bool\", \"Use premium account if available\"    , True),\n                   (\"revertfailed\", \"bool\", \"Revert to standard download if fails\", True)]\n\n    __description__ = \"\"\"Premiumize.me multi-hoster plugin\"\"\"\n    __license__     = \"GPLv3\"\n    __authors__     = [(\"Florian Franzen\", \"FlorianFranzen@gmail.com\")]\n\n\n    def handle_premium(self, pyfile):\n        #: In some cases hostsers do not supply us with a filename at download, so we\n        #: Are going to set a fall back filename (e.g. for freakshare or xfileshare)\n        pyfile.name = pyfile.name.split('/').pop()  #: Remove everthing before last slash\n\n        #: Correction for automatic assigned filename: Removing html at end if needed\n        suffix_to_remove = [\"html\", \"htm\", \"php\", \"php3\", \"asp\", \"shtm\", \"shtml\", \"cfml\", \"cfm\"]\n        temp = pyfile.name.split('.')\n        if temp.pop() in suffix_to_remove:\n            pyfile.name = \".\".join(temp)\n\n        #: Get account data\n        user, info = self.account.select()\n\n        #: Get rewritten link using the premiumize.me api v1 (see https://secure.premiumize.me/?show=api)\n        data = json_loads(self.load(\"http://api.premiumize.me/pm-api/v1.php\",  #@TODO: Revert to `https` in 0.4.10\n                                    get={'method'       : \"directdownloadlink\",\n                                         'params[login]': user,\n                                         'params[pass]' : info['login']['password'],\n                                         'params[link]' : pyfile.url}))\n\n        #: Check status and decide what to do\n        status = data['status']\n\n        if status == 200:\n            self.link = data['result']['location']\n            return\n\n        elif status == 400:\n            self.fail(_(\"Invalid link\"))\n\n        elif status == 404:\n            self.offline()\n\n        elif status >= 500:\n            self.temp_offline()\n\n        else:\n            self.fail(data['statusmessage'])\n\n\ngetInfo = create_getInfo(PremiumizeMe)\n", "path": "module/plugins/hoster/PremiumizeMe.py"}]}