-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnotification.py
More file actions
43 lines (29 loc) · 1.12 KB
/
notification.py
File metadata and controls
43 lines (29 loc) · 1.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
__author__ = 'bhavin.patel'
import facebook
import pickle
from pprint import pprint
class fbNotification:
oauth_access_token = ''
notification_score = dict()
def __init__(self):
self.graph = facebook.GraphAPI( self.oauth_access_token )
pprint ( self.oauth_access_token )
def profile(self):
self._profile = self.graph.get_object("me")
return self._profile
def friends(self):
self.friends = self.graph.get_connections("me","friends")
return self.friends
def notifications(self ,include_read=False):
self._notifications = self.graph.get_connections("me","notifications",
fields=['application'],
include_read=include_read)
for notification in self._notifications['data']:
if notification['application']['name'] not in self.notification_score :
self.notification_score[notification['application']['name'] ] = 1
else:
self.notification_score[notification['application']['name'] ] += 1
return self.notification_score
if __name__ == "__main__":
me = fbNotification()
pprint( me.notifications( True) )