Pyzillow, cannot get home attributes

江枫思渺然 提交于 2019-11-28 12:00:56

问题


Following the instructions from here. I noticed that some addresses do not work for example:

address = "5621 N Atlantic Ave, Portland, OR"
zipcode = "97217"
zillow_id = get_zillow_id(key, address, zipcode)
zillow_data = ZillowWrapper(key)
updated_property_details_response = zillow_data.get_updated_property_details(zillow_id)
result = GetUpdatedPropertyDetails(updated_property_details_response)
result.rooms # number of rooms of the home

Although, I still get the zillow_id returned which means that the address is in the zillow API which means I should still get the attributes of the home that I request I want.

I am not sure how to fix this issue as there does not seem to be many reliable libraries out there for getting home attribute data from zillow.

Here is my entire code:

from pyzillow.pyzillow import ZillowWrapper, GetDeepSearchResults, GetUpdatedPropertyDetails
import pandas as pd
import numpy as np

key = "X1-ZWz1gtmiat11xn_7ew1d"



# Create function to get zillow_id
def get_zillow_id(key, address, zipcode):
    zillow_data = ZillowWrapper(key)
    deep_search_response = zillow_data.get_deep_search_results(address, zipcode)
    result = GetDeepSearchResults(deep_search_response)
    return result.zillow_id



# Create function to get propery data
def get_property_data(key, address, zipcode):
    zillow_data = ZillowWrapper(key)
    updated_property_details_response = zillow_data.get_updated_property_details(get_zillow_id(key, address, zipcode))
    result = GetUpdatedPropertyDetails(updated_property_details_response)
    return result.year_built





# Import data into dataframe
df = pd.read_csv('test.csv')



# Create a new column to get year built
df['Year Built'] = df.apply(lambda row: get_property_data(key, row['Address'], row['Zipcode']), axis=1)



address = "5621 N Atlantic Ave, Portland, OR"
zipcode = "97217"
zillow_id = get_zillow_id(key, address, zipcode)
zillow_data = ZillowWrapper(key)
updated_property_details_response = zillow_data.get_updated_property_details(zillow_id)
result = GetUpdatedPropertyDetails(updated_property_details_response)
result.rooms # number of rooms of the home

来源:https://stackoverflow.com/questions/53989950/pyzillow-cannot-get-home-attributes

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!