Pyzillow, cannot get home attributes

2019-01-29 12:49发布

问题:

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
标签: python zillow