Subscribe method - validate return data

master
azzy9 1 year ago committed by GitHub
parent 530d0140f7
commit 85964906a5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -537,14 +537,22 @@ def subscribe( name, action ):
# subscribe to action
data = rumbleUser.subscribe( action, action_type, name )
# TODO: use data for sanity check
if action == 'subscribe':
notify( 'Subscribed to ' + name )
else:
notify( 'Unubscribed to ' + name )
if data:
# Load data from JSON
data = json.loads(data)
# make sure everything looks fine
if data.get( 'user', False ) and data.get( 'data', False ) \
and data[ 'user' ][ 'logged_in' ] and data[ 'data' ][ 'thumb' ]:
if action == 'subscribe':
notify( 'Subscribed to ' + name, None, data[ 'data' ][ 'thumb' ] )
else:
notify( 'Unubscribed to ' + name, None, data[ 'data' ][ 'thumb' ] )
return True
return True
notify( 'Unable to to perform action' )
return False

Loading…
Cancel
Save