secret
Last active

  • Download Gist
facebook_ids_from_email.py
Python
1 2 3 4 5 6 7 8 9 10 11 12 13
import email, json, urllib2
 
msg = email.message_from_file(open('facebook.eml'))
 
fb_notifiy = [tuple(t.strip().split("=")) for t in msg.get('X-Facebook-Notify').split(";")]
 
# example fb_notify
# [('event_wall',), ('eid', '14102494623'), ('from', '21602578'), ('mailid', '12bf28cG149a112G63016bG21')]
 
from_identity = json.load(urllib2.urlopen("http://graph.facebook.com/%s" % fb_notify[2][1]))
 
# example from_identity
# {u'first_name': u'Bryan', u'last_name': u'Clark', u'id': u'21602578', u'name': u'Bryan Clark'}

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.