A
A
Artem2017-05-07 15:00:57
Facebook
Artem, 2017-05-07 15:00:57

How to do search for places in Facebook Graph API using python?

Good afternoon! The second day I read the docks on the FB Graph API and I can’t find the answer to the question - is it possible to use Python to search for places on a given request? My example - I need to find, say, restaurants in Lyon (preferably get their name, address, rating (number of stars), number of likes ...). I made this script:

import facebook

graph = facebook.GraphAPI(access_token='my_token', version='2.9')
app_id = 'my_app_id'

places = graph.request('search', args={'q': 'restaurants in Lyon', 'type': 'place'})

for i in places['data']:
    print(i['name'], i['id'])

getting here is the answer:
Flunch Lyon You Vénissieux 498808510328328
Jols - Restaurants de poisson à Lyon & Limonest355937091176677
Brasserie Georges 136309956399609
Mamashelter Lyon 713076822065857
Ampère - Victor Hugo 283299121764587
Lyon's Restaurants 232636613473294
Flunch Lyon Limonest 1085264694882163
Brasserie Le SUD - Bocuse 294196634013957
Le Kitchen Café 328945663875070
McDonald's Lyon République 183260928375546
Cafe Lyon 361685103874679 Restaurant La
Mère Brazier
Tetedoie Restaurant Gastronomique 230953407007554
Brasserie Le NORD - Bocuse 154327764589755
Utopia - Restaurant éphémère 1844291849152201
Lyon's Restaurants 163109204027465
Fourvière Hôtel 774874265972102
Lyon Bistrô 881206778599365
Joseph Viola, Restaurants Daniel & Denise 666646990072238
Restaurant MARGUERITE - Bocuse 709506272412762
Tacos De Lyon Kénitra 1729862207326140
Libanais Lyon 1371073279585838
ie only 25 entries. But there are many more restaurants in Lyon... How to increase the amount of information given out? And how can you use the id of restaurants to get information about each of them (address, phone, etc.)?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question