PyZillow未返回物业详细信息

时间:2019-03-14 15:15:53

标签: xml python-2.7 unicode-escapes zillow

我正在尝试获取PyZillow API以返回property_size属性,但是代码抛出错误,不确定我是否理解。

下面是我的代码:

from pyzillow.pyzillow import ZillowWrapper, GetDeepSearchResults, GetUpdatedPropertyDetails

#My Address Details
address = '155 Demar Blvd, Canonsburg, PA'
zipcode = '15317'

#My API Key Details
zillow_data = ZillowWrapper('X1-**************_*****') #this is my ZWSID

#Getting the Zillow ID for my property (runs correctly, returns correct ID)
deep_search_response = zillow_data.get_deep_search_results(address,zipcode)
result = GetDeepSearchResults(deep_search_response)
print(result.zillow_id)
print(type(result.zillow_id)) #Checked the type to verify "result.zillow" was same type as "zillow_id" below

Zillow_id = result.zillow_id
print(Zillow_id)
print(type(Zillow_id))

#Section does not run --> returns a UnicodeEncodeError...
updated_property_details_response = zillow_data.get_updated_property_details(Zillow_id)
resultPropDetail = GetUpdatedPropertyDetails(updated_property_details_response)
print(resultPropDetail.property_size)

我收到以下输出消息:

/System/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7 "/Users/jeremypepper/Desktop/Pepperidge Code/SqFtGet.py"
49785503
<type 'str'>
49785503
<type 'str'>
Traceback (most recent call last):
  File "/Users/jeremypepper/Desktop/Pepperidge Code/SqFtGet.py", line 21, in <module>
    updated_property_details_response = zillow_data.get_updated_property_details(Zillow_id)
  File "/Library/Python/2.7/site-packages/pyzillow/pyzillow.py", line 43, in get_updated_property_details
    return self.get_data(url, params)
  File "/Library/Python/2.7/site-packages/pyzillow/pyzillow.py", line 72, in get_data
    response = ElementTree.fromstring(request.text)
  File "<string>", line 124, in XML
UnicodeEncodeError: 'ascii' codec can't encode character u'\u2026' in position 3355: ordinal not in range(128)

Process finished with exit code 1

关于什么可能是错误的任何想法?也许这是API的错误?

0 个答案:

没有答案