pip install https://github.com/slimkrazy/python-google-places/zipball/master
to install the module)
In [2]:
import json #for reading oauth info and save the results
import io
from googleplaces import GooglePlaces, types, lang
from pprint import pprint
In [3]:
with io.open('google_places_key.json') as cred:
creds = json.load(cred)
google_places = GooglePlaces(**creds)
Every account can excuete 1,000 API calls within 24 hours. The response limit of every search is 20. So again we have to narrow down the search criteria to get more data. Let's begin with the geometry of Boston Downtown Crossing.
For the parameters you can set up in the following query, go to Documentation
In [4]:
query_result = google_places.nearby_search(
lat_lng = {'lat': 42.3555885, 'lng': -71.0646816}, rankby = 'distance', types = [types.TYPE_FOOD])
Then we check if we get any results from API and print some information to the screen.
In [34]:
if query_result.raw_response:
print 'status: ' + query_result.raw_response['status']
print 'next_page_token: ' + query_result.raw_response['next_page_token']
print 'number of results: ' + str(len(query_result.raw_response['results']))
status: OK
next_page_token: CoQC-AAAAIPcUTL0pCzXoSTzALHY2OFzcZwG4e6Ur8O005U6CcGy4_xjE0fPanSwjKHFR3xmGthmw4Q5qUobFgVnC567y9wKPFyfYaakMe6M380iRPFBR6vgr4lGtMbxsN1mcn6rvmk8OZU_6QYKMSwIuMrl7CjiSAjs6IQfd0ZsMm6OQ8KWndzXw97vdSZjmtZRFHQCIil6jQAd0Wu0_VFaS48oIaA2LMS0aXddYLHIRQ3ew2LGRkBfY0eDLtm2SHK6n3_04tlVnGTWFOvt8axCtPDtF14JFEKNH1DuVXbo8i8dKTq_ELQzjjMonhI8986uyfx3j_E5PnEZNDCefpbQR_pSob0SEPROwyFCe6maxSt8IeG0c_saFAh_NC1xvlTnlpRrRIUZHcnuGlLy
number of results: 20
The response from API above contains many information:
We use vars(object)
to extend all the information in the object:
To see all the response values and their definitinos in places, go to Google Places Search Results
In [10]:
for place in query_result.places:
pprint(vars(place)) #only get geo_location, icon, id, name, place_id, rating, types, vicinty
# The following method has to make a further API call.
place.get_details() #get more details including phone_number, opening_hours, photos, reviews ... etc
pprint(vars(place))
break #Here I break when we finish the first place since 20 reesults are too long.
{'_details': {u'address_components': [{u'long_name': u'146',
u'short_name': u'146',
u'types': [u'street_number']},
{u'long_name': u'Tremont Street',
u'short_name': u'Tremont St',
u'types': [u'route']},
{u'long_name': u'Boston',
u'short_name': u'Boston',
u'types': [u'locality',
u'political']},
{u'long_name': u'Massachusetts',
u'short_name': u'MA',
u'types': [u'administrative_area_level_1',
u'political']},
{u'long_name': u'United States',
u'short_name': u'US',
u'types': [u'country', u'political']},
{u'long_name': u'02111',
u'short_name': u'02111',
u'types': [u'postal_code']},
{u'long_name': u'1202',
u'short_name': u'1202',
u'types': [u'postal_code_suffix']}],
u'adr_address': u'<span class="street-address">146 Tremont St</span>, <span class="locality">Boston</span>, <span class="region">MA</span> <span class="postal-code">02111-1202</span>, <span class="country-name">United States</span>',
u'formatted_address': u'146 Tremont St, Boston, MA 02111, United States',
u'formatted_phone_number': u'(617) 338-9876',
u'geometry': {u'location': {u'lat': Decimal('42.3552522'),
u'lng': Decimal('-71.0631123')}},
u'icon': u'https://maps.gstatic.com/mapfiles/place_api/icons/restaurant-71.png',
u'id': u'be4e4ce5b3f8c5e7dcc2c062f513b3fd6b80ac8b',
u'international_phone_number': u'+1 617-338-9876',
u'name': u"McDonald's",
u'opening_hours': {u'open_now': True,
u'periods': [{u'close': {u'day': 0,
u'time': u'2200'},
u'open': {u'day': 0,
u'time': u'0800'}},
{u'close': {u'day': 1,
u'time': u'2200'},
u'open': {u'day': 1,
u'time': u'0800'}},
{u'close': {u'day': 2,
u'time': u'2200'},
u'open': {u'day': 2,
u'time': u'0800'}},
{u'close': {u'day': 3,
u'time': u'2200'},
u'open': {u'day': 3,
u'time': u'0800'}},
{u'close': {u'day': 4,
u'time': u'2200'},
u'open': {u'day': 4,
u'time': u'0800'}},
{u'close': {u'day': 5,
u'time': u'2200'},
u'open': {u'day': 5,
u'time': u'0800'}},
{u'close': {u'day': 6,
u'time': u'2200'},
u'open': {u'day': 6,
u'time': u'0800'}}],
u'weekday_text': [u'Monday: 8:00 AM \u2013 10:00 PM',
u'Tuesday: 8:00 AM \u2013 10:00 PM',
u'Wednesday: 8:00 AM \u2013 10:00 PM',
u'Thursday: 8:00 AM \u2013 10:00 PM',
u'Friday: 8:00 AM \u2013 10:00 PM',
u'Saturday: 8:00 AM \u2013 10:00 PM',
u'Sunday: 8:00 AM \u2013 10:00 PM']},
u'photos': [{u'height': 800,
u'html_attributions': [u'<a href="https://maps.google.com/maps/contrib/115703368770201998692/photos">Jose Rodriguez</a>'],
u'photo_reference': u'CmRdAAAAFwS7ed7EJCOXnJEQvjmhN8lq3Qom9CsEvroiqbGiVD1s77LRrpvLkBkwVDBqb-0uZRE0xnSZBWAJ5JFcS-__pY41VXapupVl04qxVdRSTNi9e24o37Op7k-l6JMYs2yrEhAsplWWJjCGJphy8nxP6Z8qGhSxe2msmckaqalXpfYh_EGJy06rlw',
u'width': 480},
{u'height': 2448,
u'html_attributions': [u'<a href="https://maps.google.com/maps/contrib/113781478627037150058/photos">Timothy Kassis</a>'],
u'photo_reference': u'CmRdAAAABi7eraRwjZLIcxGPoYWUpSB8RI26e2onnWDKmpN5y4b66wjDRR9_U5ATdS5gWcdxUhzxcUsa1iEonXG3j3hW6t_QLSkkGinZIpn3bMktP1sVhGpWxhxcJ5FzWA_0pfSBEhBcoe8AKzruyPD77AVnS7iqGhQSs4UKGOwPHv-KXTIzUwq9sc90bQ',
u'width': 3264},
{u'height': 3500,
u'html_attributions': [u'<a href="https://maps.google.com/maps/contrib/110643400660368309923/photos">McDonald's</a>'],
u'photo_reference': u'CmRdAAAAP5Qw694V0PkA_xChLPo3UiGr-DNQCNyyBy5azrFpRCAPjJiQAHvjSyHO9iUs2CBwdYY22OC020QCclkRhu3LZgzdAc8szmh0F4GH8FuiCNmRgCmqP17oQKXuZGmV2Sm5EhB0dFNduG7EiY3kQE1bSYX_GhQHUtzFtWdCZUYIdoVIFNsLh7xdNg',
u'width': 3500}],
u'place_id': u'ChIJe645PYNw44kR_0ilqhElTKw',
u'rating': Decimal('2.8'),
u'reference': u'CmReAAAAGIWcawa7cv4YkauBmf_FgKsTGPSBstGkZE-APIH4ujMsFQroKf5TAqInBhDU3nLpkVmSaIy1zHWWeRdQhdvBfmERQqFep6bLx5MC-GVccxr9OeT6vear56gxATVfrhJ2EhAXzIpnN9U37F7v-0ts7-5aGhROjOgv-aA3fYo14k0WgbtYxRj1dw',
u'reviews': [{u'aspects': [{u'rating': 0,
u'type': u'overall'}],
u'author_name': u'Casey P',
u'author_url': u'https://plus.google.com/106755311109474150935',
u'language': u'en',
u'profile_photo_url': u'//lh6.googleusercontent.com/-Gb0CWrYTvn4/AAAAAAAAAAI/AAAAAAAFJLs/FInymO9duZA/photo.jpg',
u'rating': 1,
u'text': u"Very rude and clueless staff here! I asked for an egg sandwich without any meat or cheese. They said they didn't have anything of the sort and were going to charge me for a regular Egg McMuffin (which costs over $3.50 because of the sausage and cheese).\n\nMaking it more frustrating, the person working the register was Chinese and hardly knew how to speak English, to the point that I had to point at the menu. That was literally my experience in China, except the employees at McDonald's in China can understand you a bit quicker.\n\nMeanwhile a shift manager or manager or whoever he was, stood in the back looking on. He finally stepped in to lecture me that he wouldn't be giving me a discount on the sandwich. Managers are there to reduce friction and make exceptions if it keeps someone coming back. But nope, attitude instead.",
u'time': 1452565876},
{u'aspects': [{u'rating': 0,
u'type': u'overall'}],
u'author_name': u'Brian D',
u'author_url': u'https://plus.google.com/115380442090274518928',
u'language': u'en',
u'profile_photo_url': u'//lh6.googleusercontent.com/-Ihdc7wi5bOs/AAAAAAAAAAI/AAAAAAABu0M/nYMVZ0kON18/photo.jpg',
u'rating': 1,
u'text': u"Crowded, rude staff, and one small shared bathroom. As for the food, we didn't get anything but coffee there, and though McD coffee normally tastes pretty good, the coffee there was terrible.",
u'time': 1456450146},
{u'aspects': [{u'rating': 0,
u'type': u'overall'}],
u'author_name': u'Raissa Rangel',
u'author_url': u'https://plus.google.com/116870482483767049647',
u'language': u'en',
u'rating': 1,
u'text': u'By far , THE WORST PLACE EVER. \nJust to start with,The attendant was so rude that she didn\'t even look in my face to get my order. I tried to let it go, however, I go to Mc Donalds once a week to get my " cheating meal" for quite a few years now... not a big deal : 1 mc flurry with hot fudge on top, always around 3 dol.\nAnywhere I go, for the past few years I always had the same product...same price.\nSome stores don\'t even charge me extra for the hot fudge, but some charge me $0.25 which is fine. \n\nWell, this lady decided to charge me 5 dol for the usual 3 dol Mc Flurry, and not telling me what the charge was... Surprised by the 5 dol charge, I asked if she got my order correct. She ignored me and kept looking to the door ( not sure who she was waiting for ). i asked again if the order was correct and she look at me, rolled her eyes and say " you want hot fudge? thats the price!" \n\nSo I asked to speak with the manager. She just canceled my order and got the next client WITHOUT CALLING THE MANAGER. Absolutely ignored me while I stand there looking at her. Once she finished with that customer, i stepped in and told her she wouldn\'t get another client until she actually tell the manager Im here waiting. Are you kidding me ? She looked back to the manager ( who was actually there the entire time pretending he didn\'t hear the situation) waved her head and without a word to me, just called the next customer. I was starting to get very upset. This is outrageous ! Specially for a company like Mc Donalds that I have never had this awful service in 10 years. Its unacceptable. \n\nThe manager made everything even worse. Just as rude as her, came already making a scene in front of everyone and with his zero customer service skills CLEARLY STATED THAT EVERY MC DONALDS STORE HAS THEIR OWN PRICE AND AT HIS STORE, IF I WANTED TO EAT IT THEN THAT IS THE PRICE I NEED TO PAY TO GET THE EXTRA HOT FUDGET. IF IM NOT HAPPY, LEAVE.\n\nyeah.. no doubt I left.\nand will never ever come back !\n\nI wonder how and what kind of training a manager gets to have a job there.\n',
u'time': 1448480159},
{u'aspects': [{u'rating': 0,
u'type': u'overall'}],
u'author_name': u'Ella Boon',
u'author_url': u'https://plus.google.com/113368663062258347464',
u'language': u'en',
u'rating': 1,
u'text': u"Dreadful service. Staff were rude and unhelpful. The server shouted in my partners face and raised her hand to us as we didn't say whether we wanted a 6 or 10 piece chicken meal, she then talked over us in another language to other staff and we felt very intimidated as all they did was stare at us and laugh. I will be complaining to managers as worst customer service we have both ever experienced. She was so unhelpful and tutted at us when we asked what Mc flurrys they had all she did was roll her eyes and mutter yet we were the only customers in line. Horrible and Worst Mc Donald's we have ever been to and we won't be going back. AVOID! ",
u'time': 1444791351},
{u'aspects': [{u'rating': 0,
u'type': u'overall'}],
u'author_name': u'Jessica Anne',
u'author_url': u'https://plus.google.com/100208266025165840497',
u'language': u'en',
u'profile_photo_url': u'//lh4.googleusercontent.com/-_KzLlkuuzSg/AAAAAAAAAAI/AAAAAAAAAIg/lMt-HaeYxos/photo.jpg',
u'rating': 1,
u'text': u"DO NOT GO HERE. They charged us twice the amount by accident, then took out half of the food saying we owed more money. The cashier could barely speak English, but she was the nicest one there. The manager and another worker were being so mean to her for not knowing what to do, but she could barely understand us and they weren't helping. The food was OK, but they didn't even mix up my iced coffee. ",
u'time': 1448644710}],
u'scope': u'GOOGLE',
u'types': [u'restaurant',
u'food',
u'point_of_interest',
u'establishment'],
u'url': u'https://maps.google.com/?cid=12415339030561245439',
u'user_ratings_total': 18,
u'utc_offset': -240,
u'vicinity': u'146 Tremont Street, Boston',
u'website': u'https://mylocalmcds.com/tremont-street/'},
'_geo_location': {u'lat': Decimal('42.3552522'),
u'lng': Decimal('-71.0631123')},
'_icon': u'https://maps.gstatic.com/mapfiles/place_api/icons/restaurant-71.png',
'_id': u'be4e4ce5b3f8c5e7dcc2c062f513b3fd6b80ac8b',
'_name': u"McDonald's",
'_place_id': u'ChIJe645PYNw44kR_0ilqhElTKw',
'_query_instance': <googleplaces.GooglePlaces object at 0x10ddb8e90>,
'_rating': Decimal('2.8'),
'_reference': u'CmReAAAAEZ_oBdZcDHlp-FmDoId9O1Z-VZ-nY3FLgpzPWI99PTp_c7KMklxGTXSLI2SZujWtY6KS_gpxnf7ot_9OPlXEAKMoUSw9Cjp2b3JZojGDGWo5EWZgN6SV2czA5nk29oQBEhCNaXI7g_FmLacS6Xtr3QBPGhTI_HQHl3Ufblu9rNUIvJNeb6kZpw',
'_types': [u'restaurant', u'food', u'point_of_interest', u'establishment'],
'_vicinity': u'146 Tremont Street, Boston'}
{'_details': {u'address_components': [{u'long_name': u'146',
u'short_name': u'146',
u'types': [u'street_number']},
{u'long_name': u'Tremont Street',
u'short_name': u'Tremont St',
u'types': [u'route']},
{u'long_name': u'Boston',
u'short_name': u'Boston',
u'types': [u'locality',
u'political']},
{u'long_name': u'Massachusetts',
u'short_name': u'MA',
u'types': [u'administrative_area_level_1',
u'political']},
{u'long_name': u'United States',
u'short_name': u'US',
u'types': [u'country', u'political']},
{u'long_name': u'02111',
u'short_name': u'02111',
u'types': [u'postal_code']},
{u'long_name': u'1202',
u'short_name': u'1202',
u'types': [u'postal_code_suffix']}],
u'adr_address': u'<span class="street-address">146 Tremont St</span>, <span class="locality">Boston</span>, <span class="region">MA</span> <span class="postal-code">02111-1202</span>, <span class="country-name">United States</span>',
u'formatted_address': u'146 Tremont St, Boston, MA 02111, United States',
u'formatted_phone_number': u'(617) 338-9876',
u'geometry': {u'location': {u'lat': Decimal('42.3552522'),
u'lng': Decimal('-71.0631123')}},
u'icon': u'https://maps.gstatic.com/mapfiles/place_api/icons/restaurant-71.png',
u'id': u'be4e4ce5b3f8c5e7dcc2c062f513b3fd6b80ac8b',
u'international_phone_number': u'+1 617-338-9876',
u'name': u"McDonald's",
u'opening_hours': {u'open_now': True,
u'periods': [{u'close': {u'day': 0,
u'time': u'2200'},
u'open': {u'day': 0,
u'time': u'0800'}},
{u'close': {u'day': 1,
u'time': u'2200'},
u'open': {u'day': 1,
u'time': u'0800'}},
{u'close': {u'day': 2,
u'time': u'2200'},
u'open': {u'day': 2,
u'time': u'0800'}},
{u'close': {u'day': 3,
u'time': u'2200'},
u'open': {u'day': 3,
u'time': u'0800'}},
{u'close': {u'day': 4,
u'time': u'2200'},
u'open': {u'day': 4,
u'time': u'0800'}},
{u'close': {u'day': 5,
u'time': u'2200'},
u'open': {u'day': 5,
u'time': u'0800'}},
{u'close': {u'day': 6,
u'time': u'2200'},
u'open': {u'day': 6,
u'time': u'0800'}}],
u'weekday_text': [u'Monday: 8:00 AM \u2013 10:00 PM',
u'Tuesday: 8:00 AM \u2013 10:00 PM',
u'Wednesday: 8:00 AM \u2013 10:00 PM',
u'Thursday: 8:00 AM \u2013 10:00 PM',
u'Friday: 8:00 AM \u2013 10:00 PM',
u'Saturday: 8:00 AM \u2013 10:00 PM',
u'Sunday: 8:00 AM \u2013 10:00 PM']},
u'photos': [{u'height': 800,
u'html_attributions': [u'<a href="https://maps.google.com/maps/contrib/115703368770201998692/photos">Jose Rodriguez</a>'],
u'photo_reference': u'CmRdAAAAFwS7ed7EJCOXnJEQvjmhN8lq3Qom9CsEvroiqbGiVD1s77LRrpvLkBkwVDBqb-0uZRE0xnSZBWAJ5JFcS-__pY41VXapupVl04qxVdRSTNi9e24o37Op7k-l6JMYs2yrEhAsplWWJjCGJphy8nxP6Z8qGhSxe2msmckaqalXpfYh_EGJy06rlw',
u'width': 480},
{u'height': 2448,
u'html_attributions': [u'<a href="https://maps.google.com/maps/contrib/113781478627037150058/photos">Timothy Kassis</a>'],
u'photo_reference': u'CmRdAAAABi7eraRwjZLIcxGPoYWUpSB8RI26e2onnWDKmpN5y4b66wjDRR9_U5ATdS5gWcdxUhzxcUsa1iEonXG3j3hW6t_QLSkkGinZIpn3bMktP1sVhGpWxhxcJ5FzWA_0pfSBEhBcoe8AKzruyPD77AVnS7iqGhQSs4UKGOwPHv-KXTIzUwq9sc90bQ',
u'width': 3264},
{u'height': 3500,
u'html_attributions': [u'<a href="https://maps.google.com/maps/contrib/110643400660368309923/photos">McDonald's</a>'],
u'photo_reference': u'CmRdAAAAP5Qw694V0PkA_xChLPo3UiGr-DNQCNyyBy5azrFpRCAPjJiQAHvjSyHO9iUs2CBwdYY22OC020QCclkRhu3LZgzdAc8szmh0F4GH8FuiCNmRgCmqP17oQKXuZGmV2Sm5EhB0dFNduG7EiY3kQE1bSYX_GhQHUtzFtWdCZUYIdoVIFNsLh7xdNg',
u'width': 3500}],
u'place_id': u'ChIJe645PYNw44kR_0ilqhElTKw',
u'rating': Decimal('2.8'),
u'reference': u'CmReAAAAGIWcawa7cv4YkauBmf_FgKsTGPSBstGkZE-APIH4ujMsFQroKf5TAqInBhDU3nLpkVmSaIy1zHWWeRdQhdvBfmERQqFep6bLx5MC-GVccxr9OeT6vear56gxATVfrhJ2EhAXzIpnN9U37F7v-0ts7-5aGhROjOgv-aA3fYo14k0WgbtYxRj1dw',
u'reviews': [{u'aspects': [{u'rating': 0,
u'type': u'overall'}],
u'author_name': u'Casey P',
u'author_url': u'https://plus.google.com/106755311109474150935',
u'language': u'en',
u'profile_photo_url': u'//lh6.googleusercontent.com/-Gb0CWrYTvn4/AAAAAAAAAAI/AAAAAAAFJLs/FInymO9duZA/photo.jpg',
u'rating': 1,
u'text': u"Very rude and clueless staff here! I asked for an egg sandwich without any meat or cheese. They said they didn't have anything of the sort and were going to charge me for a regular Egg McMuffin (which costs over $3.50 because of the sausage and cheese).\n\nMaking it more frustrating, the person working the register was Chinese and hardly knew how to speak English, to the point that I had to point at the menu. That was literally my experience in China, except the employees at McDonald's in China can understand you a bit quicker.\n\nMeanwhile a shift manager or manager or whoever he was, stood in the back looking on. He finally stepped in to lecture me that he wouldn't be giving me a discount on the sandwich. Managers are there to reduce friction and make exceptions if it keeps someone coming back. But nope, attitude instead.",
u'time': 1452565876},
{u'aspects': [{u'rating': 0,
u'type': u'overall'}],
u'author_name': u'Brian D',
u'author_url': u'https://plus.google.com/115380442090274518928',
u'language': u'en',
u'profile_photo_url': u'//lh6.googleusercontent.com/-Ihdc7wi5bOs/AAAAAAAAAAI/AAAAAAABu0M/nYMVZ0kON18/photo.jpg',
u'rating': 1,
u'text': u"Crowded, rude staff, and one small shared bathroom. As for the food, we didn't get anything but coffee there, and though McD coffee normally tastes pretty good, the coffee there was terrible.",
u'time': 1456450146},
{u'aspects': [{u'rating': 0,
u'type': u'overall'}],
u'author_name': u'Raissa Rangel',
u'author_url': u'https://plus.google.com/116870482483767049647',
u'language': u'en',
u'rating': 1,
u'text': u'By far , THE WORST PLACE EVER. \nJust to start with,The attendant was so rude that she didn\'t even look in my face to get my order. I tried to let it go, however, I go to Mc Donalds once a week to get my " cheating meal" for quite a few years now... not a big deal : 1 mc flurry with hot fudge on top, always around 3 dol.\nAnywhere I go, for the past few years I always had the same product...same price.\nSome stores don\'t even charge me extra for the hot fudge, but some charge me $0.25 which is fine. \n\nWell, this lady decided to charge me 5 dol for the usual 3 dol Mc Flurry, and not telling me what the charge was... Surprised by the 5 dol charge, I asked if she got my order correct. She ignored me and kept looking to the door ( not sure who she was waiting for ). i asked again if the order was correct and she look at me, rolled her eyes and say " you want hot fudge? thats the price!" \n\nSo I asked to speak with the manager. She just canceled my order and got the next client WITHOUT CALLING THE MANAGER. Absolutely ignored me while I stand there looking at her. Once she finished with that customer, i stepped in and told her she wouldn\'t get another client until she actually tell the manager Im here waiting. Are you kidding me ? She looked back to the manager ( who was actually there the entire time pretending he didn\'t hear the situation) waved her head and without a word to me, just called the next customer. I was starting to get very upset. This is outrageous ! Specially for a company like Mc Donalds that I have never had this awful service in 10 years. Its unacceptable. \n\nThe manager made everything even worse. Just as rude as her, came already making a scene in front of everyone and with his zero customer service skills CLEARLY STATED THAT EVERY MC DONALDS STORE HAS THEIR OWN PRICE AND AT HIS STORE, IF I WANTED TO EAT IT THEN THAT IS THE PRICE I NEED TO PAY TO GET THE EXTRA HOT FUDGET. IF IM NOT HAPPY, LEAVE.\n\nyeah.. no doubt I left.\nand will never ever come back !\n\nI wonder how and what kind of training a manager gets to have a job there.\n',
u'time': 1448480159},
{u'aspects': [{u'rating': 0,
u'type': u'overall'}],
u'author_name': u'Ella Boon',
u'author_url': u'https://plus.google.com/113368663062258347464',
u'language': u'en',
u'rating': 1,
u'text': u"Dreadful service. Staff were rude and unhelpful. The server shouted in my partners face and raised her hand to us as we didn't say whether we wanted a 6 or 10 piece chicken meal, she then talked over us in another language to other staff and we felt very intimidated as all they did was stare at us and laugh. I will be complaining to managers as worst customer service we have both ever experienced. She was so unhelpful and tutted at us when we asked what Mc flurrys they had all she did was roll her eyes and mutter yet we were the only customers in line. Horrible and Worst Mc Donald's we have ever been to and we won't be going back. AVOID! ",
u'time': 1444791351},
{u'aspects': [{u'rating': 0,
u'type': u'overall'}],
u'author_name': u'Jessica Anne',
u'author_url': u'https://plus.google.com/100208266025165840497',
u'language': u'en',
u'profile_photo_url': u'//lh4.googleusercontent.com/-_KzLlkuuzSg/AAAAAAAAAAI/AAAAAAAAAIg/lMt-HaeYxos/photo.jpg',
u'rating': 1,
u'text': u"DO NOT GO HERE. They charged us twice the amount by accident, then took out half of the food saying we owed more money. The cashier could barely speak English, but she was the nicest one there. The manager and another worker were being so mean to her for not knowing what to do, but she could barely understand us and they weren't helping. The food was OK, but they didn't even mix up my iced coffee. ",
u'time': 1448644710}],
u'scope': u'GOOGLE',
u'types': [u'restaurant',
u'food',
u'point_of_interest',
u'establishment'],
u'url': u'https://maps.google.com/?cid=12415339030561245439',
u'user_ratings_total': 18,
u'utc_offset': -240,
u'vicinity': u'146 Tremont Street, Boston',
u'website': u'https://mylocalmcds.com/tremont-street/'},
'_geo_location': {u'lat': Decimal('42.3552522'),
u'lng': Decimal('-71.0631123')},
'_icon': u'https://maps.gstatic.com/mapfiles/place_api/icons/restaurant-71.png',
'_id': u'be4e4ce5b3f8c5e7dcc2c062f513b3fd6b80ac8b',
'_name': u"McDonald's",
'_place_id': u'ChIJe645PYNw44kR_0ilqhElTKw',
'_query_instance': <googleplaces.GooglePlaces object at 0x10ddb8e90>,
'_rating': Decimal('2.8'),
'_reference': u'CmReAAAAEZ_oBdZcDHlp-FmDoId9O1Z-VZ-nY3FLgpzPWI99PTp_c7KMklxGTXSLI2SZujWtY6KS_gpxnf7ot_9OPlXEAKMoUSw9Cjp2b3JZojGDGWo5EWZgN6SV2czA5nk29oQBEhCNaXI7g_FmLacS6Xtr3QBPGhTI_HQHl3Ufblu9rNUIvJNeb6kZpw',
'_types': [u'restaurant', u'food', u'point_of_interest', u'establishment'],
'_vicinity': u'146 Tremont Street, Boston'}
In [ ]:
result = []
#Put your lantitude and longtitude pairs in the list and run the search in turns
lat_lng_list = [{'lat': 2.356357, 'lng': -71.0623345}, #Park Street Station
{'lat': 42.356357, 'lng': -71.0623345}, #China Town Station
{'lat': 42.3555885, 'lng': -71.0646816}] #Downtown Crossing Station
for pair in lat_lng_list:
query_result = google_places.nearby_search(
lat_lng = pair, rankby = 'distance', types = [types.TYPE_FOOD])
for place in query_result.places:
place.get_details()
tmp = vars(place)
results.append(tmp)
with open('my_boston_restaurants_google_places.json', 'wb') as f:
results_json = json.dumps(results, indent=4, skipkeys=True, sort_keys=True)
f.write(results_json)
Content source: missmoss/python-scraper
Similar notebooks: