mirror of
https://github.com/clinton-hall/nzbToMedia.git
synced 2025-08-14 02:26:53 -07:00
Use params for auto fork. #1765
This commit is contained in:
parent
7f8397b516
commit
f10fa03159
1 changed files with 6 additions and 6 deletions
|
@ -112,13 +112,15 @@ def auto_fork(section, input_category):
|
|||
# then in order of most unique parameters.
|
||||
|
||||
if apikey:
|
||||
url = '{protocol}{host}:{port}{root}/api/{apikey}/?cmd=sg.postprocess&help=1'.format(
|
||||
url = '{protocol}{host}:{port}{root}/api/{apikey}/'.format(
|
||||
protocol=protocol, host=host, port=port, root=web_root, apikey=apikey,
|
||||
)
|
||||
api_params = {'cmd': 'sg.postprocess', 'help': '1'}
|
||||
else:
|
||||
url = '{protocol}{host}:{port}{root}/home/postprocess/'.format(
|
||||
protocol=protocol, host=host, port=port, root=web_root,
|
||||
)
|
||||
api_params = {}
|
||||
|
||||
# attempting to auto-detect fork
|
||||
try:
|
||||
|
@ -131,7 +133,7 @@ def auto_fork(section, input_category):
|
|||
if r.status_code in [401, 403] and r.cookies.get('_xsrf'):
|
||||
login_params['_xsrf'] = r.cookies.get('_xsrf')
|
||||
s.post(login, data=login_params, stream=True, verify=False)
|
||||
r = s.get(url, auth=(username, password), verify=False)
|
||||
r = s.get(url, auth=(username, password), params=api_params, verify=False)
|
||||
except requests.ConnectionError:
|
||||
logger.info('Could not connect to {section}:{category} to perform auto-fork detection!'.format
|
||||
(section=section, category=input_category))
|
||||
|
@ -142,11 +144,9 @@ def auto_fork(section, input_category):
|
|||
if found:
|
||||
params['cmd'] = 'sg.postprocess'
|
||||
else: # try different api set for non-SickGear forks.
|
||||
url = '{protocol}{host}:{port}{root}/api/{apikey}/?cmd=help&subject=postprocess'.format(
|
||||
protocol=protocol, host=host, port=port, root=web_root, apikey=apikey,
|
||||
)
|
||||
api_params = {'cmd': 'help', 'subject': 'postprocess'}
|
||||
try:
|
||||
r = s.get(url, auth=(username, password), verify=False)
|
||||
r = s.get(url, auth=(username, password), params=api_params, verify=False)
|
||||
except requests.ConnectionError:
|
||||
logger.info('Could not connect to {section}:{category} to perform auto-fork detection!'.format
|
||||
(section=section, category=input_category))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue