+ Added support for PassTheHeadphones.me

% Removed hardcoding for What.CD in pygazelle API, making it easy to add other Gazelle-based trackers

+ Added URL parameter for What.CD and PTH, in case they come back under a new domain name
This commit is contained in:
Denzo
2016-11-29 20:49:52 +01:00
parent 0a805a01f3
commit b6b33e1b1e
5 changed files with 152 additions and 6 deletions
+4 -4
View File
@@ -42,7 +42,7 @@ class GazelleAPI(object):
'Accept-Charset': 'ISO-8859-1,utf-8;q=0.7,*;q=0.3'}
def __init__(self, username=None, password=None):
def __init__(self, username=None, password=None, url=None):
self.session = requests.session()
self.session.headers = self.default_headers
self.username = username
@@ -59,7 +59,7 @@ class GazelleAPI(object):
self.cached_torrents = {}
self.cached_requests = {}
self.cached_categories = {}
self.site = "https://what.cd/"
self.site = url + "/"
self.past_request_timestamps = []
def wait_for_rate_limit(self):
@@ -95,7 +95,7 @@ class GazelleAPI(object):
self.wait_for_rate_limit()
loginpage = 'https://what.cd/login.php'
loginpage = self.site + 'login.php'
data = {'username': self.username,
'password': self.password,
'keeplogged': '1'}
@@ -122,7 +122,7 @@ class GazelleAPI(object):
Pass an action and relevant arguments for that action.
"""
def make_request(action, **kwargs):
ajaxpage = 'ajax.php'
ajaxpage = '/ajax.php'
content = self.unparsed_request(ajaxpage, action, **kwargs)
try:
if not isinstance(content, text_type):