I want to make a simple Wall Post on my facebook page. I have APP_ID + APP SECRET and I can get the access token, but I'm struggling with facebook.GraphAPI () This is the code:
# -*- coding: utf-8 -*- import urllib import facebook FACEBOOK_APP_ID = '12345' FACEBOOK_APP_SECRET = '123456789' FACEBOOK_PROFILE_ID = '321321321321' oauth_args = dict( client_id = FACEBOOK_APP_ID, client_secret = FACEBOOK_APP_SECRET, grant_type = 'client_credentials') oauth_response = urllib.urlopen('https://graph.facebook.com/oauth/access_token?' + urllib.urlencode(oauth_args)).read()
When I run the script, I get this error:
Traceback (most recent call last): File "fb.py", line 27, in <module> facebook_graph = facebook.GraphAPI(oauth_response.split('=')[1]) AttributeError: 'module' object has no attribute 'GraphAPI'
I tried this code on windows and ubuntu machine, same error. I tried reinstalling the facebook module but nothing helped. Does anyone know how to solve this problem?
EDIT: when I add import pydoc; pydoc.help(facebook)
import pydoc; pydoc.help(facebook)
, this is the output:
Help on package facebook: NAME facebook - TODO: Document your package. FILE c:\python26\lib\site-packages\facebook-0.0-py2.6.egg\facebook\__init__.py PACKAGE CONTENTS DATA __loader__ = <zipimporter object "C:\Python26\lib\site-packages\facebo... __version__ = 'TODO: Enter a version' VERSION TODO: Enter a version Traceback (most recent call last): File "fb.py", line 29, in <module> facebook_graph = facebook.GraphAPI(oauth_response.split('=')[1]) AttributeError: 'module' object has no attribute 'GraphAPI'
source share