Change the calls according to Facebook's changed API and rate limits
Creating the issue to keep track. Not planning to fix this myself in the near future. Feel free to own and solve.
I have a small doubt in what you have written :
if comment: reply = choice(message_set) print 'Replying %s to %s' % (reply, wish['from']) url = 'https://graph.facebook.com/%s/comments?access_token=%s' % (wish['id'], access_token) requests.post(url, data={'message': reply}, proxies=proxy_dict)
Isn't this supposed to be iterating over "post"
print 'Replying %s to %s' % (reply, post['from']) url = 'https://graph.facebook.com/%s/comments?access_token=%s' % (post['id'], access_token)
Just wondering if this did work for you without the above change ?
Wrote it long time ago back in school.
Definitely worked for me as I used it on my birthday
Haha ,I was expecting this , I was hesitant to ask but just gave it a shot .
hey! how ur accessing the tokens i mean i went to the link u mentioned logged in and then checked in the boxes manage_pages and publish_pages, then the token generated gets expired every time..thanks
After some minor modifications, I was able to get this code functional again.
-
Regarding JaharshKotha's post, the answers is yes, in the current version, you are iterating with post but accessing "wish". I changed the "wish" occurrences with "post", this was easy as you would get a very explicit error.
-
Regarding the facebook changed API, I had to modify the params line with the following: "params = {'since': utc_bday, 'access_token': access_token, 'fields': 'id,message,from,name,type'}". Apparently, now you just get a couple fields by default and you must explicitly specify the fields you want to receive.
-
The like functionality is no longer supported by the API: https://developers.facebook.com/bugs/1754734484744033/
-
I also had a problem testing this code with only one post, when assigning next_url. As this was my first test, I don't know if this was happening in cases with multiple posts. Anyway, to solve that error, I added a try catch block when we assign next_url. I catch the exception KeyError and return "wishes".
Think that's it... Successfully tested right now.
@Fernuts92 Awesome, do you want to send a Pull Request and fix this for everyone?
@rishirdua I have worked out my own code long back after I had issues with yours , would you like to test and pull it in ? https://github.com/JaharshKotha/Fb-birthday-bot