mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-16 02:02:58 -07:00
Add ping method to refresh token
This commit is contained in:
parent
efdd4156d8
commit
1e4fc05ecf
1 changed files with 23 additions and 0 deletions
|
@ -80,6 +80,7 @@ def get_server_resources(return_presence=False, return_server=False, return_info
|
|||
port=server['pms_port'])
|
||||
|
||||
plex_tv = PlexTV()
|
||||
plex_tv.ping()
|
||||
result = plex_tv.get_server_connections(pms_identifier=server['pms_identifier'],
|
||||
pms_ip=server['pms_ip'],
|
||||
pms_port=server['pms_port'],
|
||||
|
@ -347,6 +348,13 @@ class PlexTV(object):
|
|||
|
||||
return request
|
||||
|
||||
def ping_plextv(self, output_format=''):
|
||||
uri = '/api/v2/ping'
|
||||
request = self.request_handler.make_request(uri=uri,
|
||||
request_type='GET',
|
||||
output_format=output_format)
|
||||
return request
|
||||
|
||||
def get_full_users_list(self):
|
||||
own_account = self.get_plextv_user_details(output_format='xml')
|
||||
friends_list = self.get_plextv_friends(output_format='xml')
|
||||
|
@ -950,3 +958,18 @@ class PlexTV(object):
|
|||
}
|
||||
|
||||
return geo_info
|
||||
|
||||
def ping(self):
|
||||
logger.info(u"Tautulli PlexTV :: Pinging Plex.tv to refresh token.")
|
||||
|
||||
pong = self.ping_plextv(output_format='xml')
|
||||
|
||||
try:
|
||||
xml_head = pong.getElementsByTagName('pong')
|
||||
except Exception as e:
|
||||
logger.warn(u"Tautulli PlexTV :: Unable to parse XML for ping: %s." % e)
|
||||
return None
|
||||
|
||||
if xml_head:
|
||||
return helpers.bool_true(xml_head[0].firstChild.nodeValue)
|
||||
return False
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue