我试图让 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 的错误?