Skip to content

Instantly share code, notes, and snippets.

@PhanDuc
Last active October 19, 2016 07:22
Show Gist options
  • Save PhanDuc/cd2111012bf9ca44ea16888abc842258 to your computer and use it in GitHub Desktop.
Save PhanDuc/cd2111012bf9ca44ea16888abc842258 to your computer and use it in GitHub Desktop.
Hide comment facebook
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