Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

avoid sending "apikey" parameter if "apikey==0" #427

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 20 additions & 5 deletions nzbhydra/searchmodules/newznab.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,10 @@ def test_connection(host, apikey):
logger.info("Testing connection for host %s" % host)
f = furl(host)
f.path.add("api")
f.query.add({"apikey": apikey, "t": "tvsearch"})
if apikey == "0":
f.query.add({"t": "tvsearch"})
else:
f.query.add({"apikey": apikey, "t": "tvsearch"})
try:
headers = {
'User-Agent': config.settings.searching.userAgent
Expand Down Expand Up @@ -318,7 +321,10 @@ def check_caps(host, apikey, userAgent=None, timeout=None, skipIdsAndTypes=False
def _build_base_url(host, apikey, action, category, limit=None, offset=0):
f = furl(host)
f.path.add("api")
f.query.add({"apikey": apikey, "extended": 1, "t": action, "offset": offset})
if apikey == "0":
f.query.add({"extended": 1, "t": action, "offset": offset})
else:
f.query.add({"apikey": apikey, "extended": 1, "t": action, "offset": offset})
if limit is not None:
f.query.add({"limit": limit})

Expand Down Expand Up @@ -490,7 +496,10 @@ def get_details_link(self, guid):
def get_entry_by_id(self, guid, title):
url = furl(self.settings.host)
url.path.add("api")
url.add({"apikey": self.settings.apikey, "t": "details", "o": "xml", "id": guid})
if self.settings.apikey == "0":
url.add({"t": "details", "o": "xml", "id": guid})
else:
url.add({"apikey": self.settings.apikey, "t": "details", "o": "xml", "id": guid})

response, papiaccess, _ = self.get_url_with_papi_access(url, "nfo")
if response is None:
Expand Down Expand Up @@ -648,7 +657,10 @@ def get_nfo(self, guid):
else:
logger.debug("Using t=getnfo for non-nzedb based indexer")
t = "getnfo"
url.add({"apikey": self.settings.apikey, "t": t, "o": "xml", "id": guid, "raw": "1"})
if self.settings.apikey == "0":
url.add({"t": t, "o": "xml", "id": guid, "raw": "1"})
else:
url.add({"apikey": self.settings.apikey, "t": t, "o": "xml", "id": guid, "raw": "1"})

response, papiaccess, _ = self.get_url_with_papi_access(url, "nfo")
if response is None:
Expand All @@ -673,7 +685,10 @@ def get_nfo(self, guid):
def get_nzb_link(self, guid, title):
f = furl(self.settings.host)
f.path.add("api")
f.add({"t": "get", "apikey": self.settings.apikey, "id": guid})
if self.settings.apikey == "0":
f.add({"t": "get", "id": guid})
else:
f.add({"t": "get", "apikey": self.settings.apikey, "id": guid})
return f.tostr()


Expand Down