-
Notifications
You must be signed in to change notification settings - Fork 1
/
fbcommunication.py
25 lines (21 loc) · 984 Bytes
/
fbcommunication.py
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
import fbconsole as fb
class FBComm:
def __init__(self, group_id, actor_id):
self.group_id = group_id
self.actor_id = actor_id
fb.AUTH_SCOPE = ['read_stream', 'user_groups']
fb.authenticate()
def get_updatetime(self):
update_info = fb.fql('SELECT update_time FROM group WHERE ' +
'gid=' + self.group_id)
return long(update_info[0]['update_time'])
def read_stream(self, min_time):
return fb.fql('SELECT post_id, message FROM stream WHERE ' +
'source_id=' + self.group_id +
' AND actor_id=' + self.actor_id +
' AND created_time>{}'.format(min_time))
def read_comments(self, post_id, min_time):
return fb.fql('SELECT text FROM comment WHERE ' +
'post_id="' + post_id +
'" AND fromid=' + self.actor_id +
' AND time>{}'.format(min_time))