0
votes

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

1
Can you paste the entire traceback?Shiva
I did this stepsrabia nural
I dont use pip I use conda env.I have no problem pip siderabia nural

1 Answers

0
votes

To install facebook-sdk package from conda.

Run this,

conda install -c hargup/label/pypi facebook-sdk