I'm trying to embed the most recent Facebook post for my workplace on the front page of our Django site. I've got FacePy installed, an application key for access, and sometimes the post shows up, but usually it doesn't. I'm doing the embed as a custom tag, so here's the slightly modified for privacy code:
from facepy import GraphAPI
@register.simple_tag
def new_fb_post_embed():
graph = GraphAPI(<<key>>)
posts = graph.get("/me/feed")
fb_post_info = posts['data'][0]['id'].split('_')
return "<div class='fb-post' data-href='https://www.facebook.com/" + fb_post_info[0] + "/posts/" + fb_post_info[1] + "'></div>"
I'm suspecting it has something to do with using an application key, or with information being cached, but since there is no error being produced I'm really only guessing.