Facebook Graph Python for Event Information Mining -
i able return local facebook events via facebook sdk python this:
import facebook # pip install facebook-sdk import json access_token = 'caacedeose0cbap0g6qgrqhsaleb9ykeubnny3r3wqzbizprrznkyx36kzbo2oy2mbimjoki5fja27bicun4do16vrow4edl99zbnkrajvfakvnxuxtt8k9uu29fiwq6jjq9lsqzconkwvzv1ielmu30egms0qyxx8sisjfogrze00ibmvpoltibfgfno7boo75xkaubk5ntdniyay0tkgzauwabzmh8ozd' def pp(o): print json.dumps(o, indent=1) # create connection graph api access token g = facebook.graphapi(access_token) print print '---------------' print 'events' print '---------------' pp(g.request("search", {'q' : 'evansville, in', 'type' : 'event'}))
it returns this:
{ "id": "565819520206832", "start_time": "2014-11-07t19:15:00-0600", "location": "evansville, in", "name": "evansville icemen vs. wheeling nailers", "end_time": "2014-11-08t03:15:00-0600" },
i trying filter these results events happening or in future.
i tried no luck:
pp(g.request("search", {'q' : 'evansville, in', 'type' : 'event', 'until' : 'today'}))
this seems working me:
currenttime = datetime.datetime.now().strftime("%y-%m-%dt%h:%m:%s") print print '---------------' print 'events' print '---------------' t=g.request("search",{ 'q' : 'evansville', 'type' : 'event', 'limit' : 5, 'since_date' : 'currenttime'}) pp(t)
Comments
Post a Comment