mirror of
https://github.com/clinton-hall/nzbToMedia.git
synced 2025-08-14 02:26:53 -07:00
Updates to Syno Auth #1844
This commit is contained in:
parent
411e70ba92
commit
36eddcfb92
1 changed files with 3 additions and 4 deletions
|
@ -12,12 +12,11 @@ class Authentication:
|
||||||
self._base_url = 'http://%s:%s/webapi/' % (self._ip_address, self._port)
|
self._base_url = 'http://%s:%s/webapi/' % (self._ip_address, self._port)
|
||||||
|
|
||||||
self.full_api_list = {}
|
self.full_api_list = {}
|
||||||
self.app_api_list = {}
|
|
||||||
|
|
||||||
def login(self, application):
|
def login(self, application):
|
||||||
self.get_api_list('SYNO.API.Auth')
|
self.get_api_list('SYNO.API.Auth')
|
||||||
login_api = 'auth.cgi?api=SYNO.API.Auth'
|
login_api = 'auth.cgi?api=SYNO.API.Auth'
|
||||||
param = {'version': self.app_api_list['SYNO.API.Auth']['maxVersion'], 'method': 'login', 'account': self._username,
|
param = {'version': self.full_api_list['SYNO.API.Auth']['maxVersion'], 'method': 'login', 'account': self._username,
|
||||||
'passwd': self._password, 'session': application, 'format': 'cookie'}
|
'passwd': self._password, 'session': application, 'format': 'cookie'}
|
||||||
|
|
||||||
if not self._session_expire:
|
if not self._session_expire:
|
||||||
|
@ -32,7 +31,7 @@ class Authentication:
|
||||||
|
|
||||||
def logout(self, application):
|
def logout(self, application):
|
||||||
logout_api = 'auth.cgi?api=SYNO.API.Auth'
|
logout_api = 'auth.cgi?api=SYNO.API.Auth'
|
||||||
param = {'version': self.app_api_list['SYNO.API.Auth']['maxVersion'], 'method': 'logout', 'session': application}
|
param = {'version': self.full_api_list['SYNO.API.Auth']['maxVersion'], 'method': 'logout', 'session': application}
|
||||||
|
|
||||||
response = requests.get(self._base_url + logout_api, param)
|
response = requests.get(self._base_url + logout_api, param)
|
||||||
if response.json()['success'] is True:
|
if response.json()['success'] is True:
|
||||||
|
@ -53,7 +52,7 @@ class Authentication:
|
||||||
if app is not None:
|
if app is not None:
|
||||||
for key in response['data']:
|
for key in response['data']:
|
||||||
if app.lower() in key.lower():
|
if app.lower() in key.lower():
|
||||||
self.app_api_list[key] = response['data'][key]
|
self.full_api_list[key] = response['data'][key]
|
||||||
else:
|
else:
|
||||||
self.full_api_list = response['data']
|
self.full_api_list = response['data']
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue