This question has been asked, but never answered.
import facebook
graph = facebook.GraphAPI(access_token="your token",version="2.7")
From the Facebook SDK python page, I got the following code:
# Search for places near 1 Hacker Way in Menlo Park, California.
places = graph.search(type='place',
center='37.4845306,-122.1498183',
fields='name,location')
# Each given id maps to an object the contains the requested fields.
for place in places['data']:
print('%s %s' % (place['name'].encode(),place['location'].get('zip')))
Here's the link.
It doesn't work however. I don't get why. The error reads
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-21-56959958831f> in <module>()
1 # Search for places near 1 Hacker Way in Menlo Park, California.
----> 2 places = graph.search(type='place',
3 center='37.4845306,-122.1498183',
4 fields='name,location')
5
AttributeError: 'GraphAPI' object has no attribute 'search'
What does this mean? Why would the example not work? I can't seem to find documentation on the specifics of how the GraphAPI class is structured, but I assume search is part of this.
pip freeze | grep facebookand share the package name and version?facebook-sdk, is that what u mean?