Lấy cảm hứng từ this Yelp tutorial, tôi đã tạo một tập lệnh để tìm kiếm tất cả các phòng tập thể dục trong một thành phố nhất định. Tôi đã chỉnh sửa kịch bản với these updates để trả về tất cả phòng tập thể dục, không chỉ là 20. Bạn có thể tìm thấy gist here. SEARCH_LIMIT là 20.Yêu cầu không hợp lệ từ Yelp API
Tôi gặp phải lỗi Yêu cầu không hợp lệ. Tôi đã làm theo hướng dẫn của Yelp khá chặt chẽ, và không chắc chắn về những gì nó có thể đến từ - Tôi chắc rằng yêu cầu được mã hóa chính xác và tất cả các khóa API của tôi đều đúng.
Các in ra là dưới đây:
Traceback (most recent call last):
File "YelpSearch.py", line 97, in <module>
query_api()
File "YelpSearch.py", line 74, in query_api
response = search_yelp(offset)
File "YelpSearch.py", line 67, in search_yelp
return request(API_HOST, SEARCH_PATH, url_params=url_params)
File "YelpSearch.py", line 53, in request
conn = urllib2.urlopen(signed_url, None)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 127, in urlopen
return _opener.open(url, data, timeout)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 410, in open
response = meth(req, response)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 523, in http_response
'http', request, response, code, msg, hdrs)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 448, in error
return self._call_chain(*args)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 382, in _call_chain
result = func(*args)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 531, in http_error_default
raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
urllib2.HTTPError: HTTP Error 400: Bad Request
Điều đó không thay đổi bất cứ điều gì – NumenorForLife