diff options
author | Nils Hesse <nphesse@gmail.com> | 2012-11-08 23:46:51 +0100 |
---|---|---|
committer | Nils Hesse <nphesse@gmail.com> | 2012-11-08 23:46:51 +0100 |
commit | a0217bf6ef37f5ee57b2bf04baa6568adb69247a (patch) | |
tree | d8fb4dbb217d933c85034775821a849063127004 /module/plugins/hooks | |
parent | Change self.accounts to self.info for getting the cached password hash (diff) | |
download | pyload-a0217bf6ef37f5ee57b2bf04baa6568adb69247a.tar.xz |
Use a dictionary to supply HTTP requests with the GET parameters (ensure proper URL encoding)
Diffstat (limited to 'module/plugins/hooks')
-rw-r--r-- | module/plugins/hooks/ReloadCc.py | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/module/plugins/hooks/ReloadCc.py b/module/plugins/hooks/ReloadCc.py index 1d4adfbe3..e563e81ba 100644 --- a/module/plugins/hooks/ReloadCc.py +++ b/module/plugins/hooks/ReloadCc.py @@ -5,7 +5,7 @@ from module.network.RequestFactory import getURL class ReloadCc(MultiHoster): __name__ = "ReloadCc" - __version__ = "0.1" + __version__ = "0.2" __type__ = "hook" __description__ = """Reload.cc hook plugin""" @@ -16,7 +16,7 @@ class ReloadCc(MultiHoster): __author_name__ = ("Reload Team") __author_mail__ = ("hello@reload.cc") - interval = 0 # Disable periodic calls, we dont use them anyway + interval = 0 # Disable periodic calls def getHoster(self): # If no accounts are available there will be no hosters available @@ -26,16 +26,22 @@ class ReloadCc(MultiHoster): # Get account data (user, data) = self.account.selectAccount() - - pwd = "pwd=%s" % data['password'] + + # Get supported hosters list from reload.cc using the json API v1 + query_params = dict( + via='pyload', + v=1, + get_supported='true', + get_traffic='true', + user=user + ) try: - pwd = "hash=%s" % data['pwdhash'] + query_params.update(dict(hash=self.account.infos[user]['pwdhash'])) except Exception: - pass + query_params.update(dict(pwd=data['password'])) - # Get supported hosters list from reload.cc using the json API v1 - answer = getURL("https://api.reload.cc/login?via=pyload&v=1&get_supported=true&get_traffic=true&user=%s&%s" % (user, pwd)) + answer = getURL("https://api.reload.cc/login", get=query_params) data = json_loads(answer) @@ -52,7 +58,7 @@ class ReloadCc(MultiHoster): self.account = self.core.accountManager.getAccountPlugin("ReloadCc") if not self.account.canUse(): self.account = None - self.logError(_("Please add a valid reload.cc account first and restart pyLoad.")) + self.logError("Please add a valid reload.cc account first and restart pyLoad.") return # Run the overwriten core ready which actually enables the multihoster hook |