Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save jennyonjourney/f05a5ce668504ff63f67e8ffae42b58b to your computer and use it in GitHub Desktop.
Save jennyonjourney/f05a5ce668504ff63f67e8ffae42b58b to your computer and use it in GitHub Desktop.
Facebook API
# developers/facebook.com 으로 접속
import urllib.request as ur
import json
page_name='jtbcnews'
base = "https://graph.facebook.com/v2.8"
app_id = "200920440387013"
app_secret = "daccef14d5cd41c0e95060d65e66c41d"
access_token = app_id+"|"+app_secret
url = base+'/'+page_name+'/?access+token='+access_token
print(url)
req = ur.Request(url)
response = ur.urlopen(req)
if response.getcode()==200:
data = json.loads(response.read().decode('utf-8'))
print(data)
print(data['name'],":",data['id'])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment