Last active
October 19, 2016 07:22
-
-
Save PhanDuc/cd2111012bf9ca44ea16888abc842258 to your computer and use it in GitHub Desktop.
Hide comment facebook
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def hide_comment(webhook_comment_callback): | |
page_access_token = "" | |
base = "https://graph.facebook.com/v2.8" | |
node = "/%s" % webhook_comment_callback['value']['comment_id'] | |
fields = "?is_hidden=true" | |
parameters = "&access_token=%s" % page_access_token | |
url = base + node + fields + parameters | |
print("URL : ", url) | |
req = urllib.request.Request(url) | |
success = False | |
while success is False: | |
try: | |
response = urllib.request.urlopen(req) | |
if response.getcode() == 200: | |
print(response) | |
success = True | |
except Exception as e: | |
print(e) | |
print("Error for URL %s" % (url)) | |
print("Retrying.") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment