1

我正在尝试使用以下代码获取 Zillow ID:

from pyzillow.pyzillow import ZillowWrapper, GetDeepSearchResults,GetUpdatedPropertyDetails
address = '1600 Pennsylvania Ave NW, Washington, DC'
zipcode = '20006'
zillow_data = ZillowWrapper('API Key')
deep_search_response = zillow_data.get_deep_search_results(address,zipcode)
result = GetDeepSearchResults(deep_search_response)
print(result.zillow_id) 

关于为什么上述方法不起作用的任何想法?这是错误:

ZillowFail                                Traceback (most recent call last)
<ipython-input-12-7f34d0e7b6f0> in <module>()
      3 zipcode = '60053'
      4 zillow_data = ZillowWrapper('API Key')
----> 5 deep_search_response = zillow_data.get_deep_search_results(address,zipcode)
      6 result = GetDeepSearchResults(deep_search_response)
      7 print(result.zillow_id)

/home/mfranzidis/pyenvs/numeric/lib/python2.7/site-packages/pyzillow/pyzillow.pyc in get_deep_search_results(self, address, zipcode)
     29             'zws-id': self.api_key
     30         }
---> 31         return self.get_data(url, params)
     32 
     33     def get_updated_property_details(self, zpid):

/home/mfranzidis/pyenvs/numeric/lib/python2.7/site-packages/pyzillow/pyzillow.pyc in get_data(self, url, params)
     62             requests.exceptions.TooManyRedirects,
     63                 requests.exceptions.Timeout):
---> 64             raise ZillowFail
     65 
     66         try:

ZillowFail: 
4

1 回答 1

1

这看起来像是 Zillow API 的问题。正如您所看到的,它因请求过多的重定向异常而失败,因此可能在他们的 API 端出现重定向循环:

/home/mfranzidis/pyenvs/numeric/lib/python2.7/site-packages/pyzillow/pyzillow.pyc in get_data(self, url, params)
     62             requests.exceptions.TooManyRedirects,

他们的库没有很好地处理这个ZillowFail问题,在这种情况下,它似乎抛出了一个带有空消息的异常。

于 2018-11-13T13:14:01.773 回答