简体   繁体   中英

Retrieve the reviews of a particular user on Yelp using Python

Given a user ID on YELP.com, how can I fetch the reviews written by that person? PS, I'm using yelpapi package in Python. My code is simple and as an example to search for a specific term I have it is something like the following. But I need to search based on a "user_id" instead of "term" or "location" in my example. Apparently search_query doesn't have any argument for user ID.

from yelpapi import YelpAPI
from pprint import pprint


CONSUMER_KEY = ''
CONSUMER_SECRET = ''
TOKEN = ''
TOKEN_SECRET = ''


yelp_api = YelpAPI(CONSUMER_KEY, CONSUMER_SECRET, TOKEN, TOKEN_SECRET)

response = yelp_api.search_query(term = 'Restaurant', location = 'Prodidence, RI',
                                 sort = 2, limit = 1)
pprint(response)

You aren't able to. The Yelp API is intentionally limited to a few types of queries, and grabbing user data is not available.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM