def check_lotteries(): lotteries = Lottery() for lottery in lotteries.get_incompleted(): graph = GraphAPI(lottery['page_token']) page = graph.get(lottery['post_id']) if page.get('likes', 0) >=lottery['likes_to_finish']: fb_page = GraphAPI(lottery['page_token']) post = graph.post(path='%s/feed' % lottery['page_id'], message='success') post = graph.post(path='%s/feed' % lottery['page_id'], message='test cel')