I wrote this on my birthday,
import facebook graph = facebook.GraphAPI('Access token you got from facebook developers page') feed = graph.get_connections("suryateja.cheedella", "feed?limit=200") for a in range (0,200): post = feed["data"][a] fromDetails = (post["from"]) fromName = fromDetails["name"] graph.put_like(post["id"]) graph.put_object(post["id"], "comments", message="Thank you :d " + fromName)
and then there, it thanked all my friends who wished me on my timeline.
Hello, what’s up guys,
It’s afternoon on 4th and as usually I am browsing on quora and facebook. I stumbled upon ‘what are the best python codes you have written’ question on quora. I saw some top answers which are actually thanking friends on FB on their birthday. Actually it’s the best time to learn or just copy&paste all of that code so, I can make my thanking task easy for tomorrow. But, I wrote ‘Hello world’ program in python just two weeks back. And completed reading like 100 pages of ‘Head first python’. So, I started searching on web and got to know about some thing called GraphAPI. After spending like 5 to 6 hours, I wrote that 10 lines of code (in a perfectly working condition) and tested it.
You can say, dude why don’t you use that already written code found on quora. Basically all those codes are old. I mean those are the codes written before releasing GraphAPI by facebook. With that thing for facebook developers, one can reduce their code to 10 lines (yeah, you look their) from 40 to 50 lines of code which I have found on Quora.
That is not the best way to reach our goal (like commenting on last ‘x’ number of posts on my wall) but, that is what I can learn in that span of time.