#NEWLINE# @ requires ( 'facebook.access_token' ) #NEWLINE# def friends_count( gauge_factory , config , logger ) : #NEWLINE# #INDENT# gauge = gauge_factory ( 'facebook.friends' ) #NEWLINE# graph = facebook . GraphAPI ( config [ 'facebook.access_token' ] ) #NEWLINE# resp = graph . fql ( 'SELECT friend_count FROM user WHERE uid = me()' ) #NEWLINE# friends = resp [ 0 ] [ 'friend_count' ] #NEWLINE# gauge . save ( today_utc ( ) , config ) #NEWLINE# logger . info ( 'Saved Facebook friend count: {0}' . format ( friends ) )