0

I try to connect to facebook api with Python. I am using anaconda and also I get the following error:

I use anaconda

import json
import facebook

def main():
    token = "--token-key--"
    graph = facebook.GraphAPI(token)
    profile = graph.get_object('me',fields='first_name')    
    print(json.dumps(profile, indent=4))

Error:

File "C:/Users/rabia.nural/Desktop/untitled6.py", line 9, in import facebook File "C:\Users\rabia.nural\AppData\Local\Continuum\anaconda3\lib\site-packages\facebook.py", line 222 except urllib2.HTTPError, e: ^ SyntaxError: invalid syntax

shaik moeed
  • 5,300
  • 1
  • 18
  • 54

1 Answers1

0

To install facebook-sdk package from conda.

Run this,

conda install -c hargup/label/pypi facebook-sdk
shaik moeed
  • 5,300
  • 1
  • 18
  • 54