def generate_Comp_fields_txt(): f_name = open("UpdatedHomeLatLong.txt", "r") data_base = open("OnlyCompFields.txt", "+w") write_out = "street_address | zipcode | zillow_id | Zestimate | Home_type | num_bath | num_bed | home_size | Lat | Long | img url | home description " data_base.write(write_out) #f_name=["2893 Springdale Ln, Boulder, CO|80303|13239207|630640|Townhouse|3.5|1|1297|40.009373|-105.255454"] x = 0 for line in f_name: line = line.rstrip("\n") address = line if x == 100: break try: street_address = re.search("(.*?)(?<=CO)", address) street_address = street_address.group(0) zipcode = re.search("(?<=CO\|)(.*?)(?=\|)", address) zipcode = zipcode.group(0) #!Get information from first zillow call zillow_data = ZillowWrapper(zws_id) deep_search_response = zillow_data.get_deep_search_results( street_address, zipcode) result = GetDeepSearchResults(deep_search_response) #!!The following will be stored as values in database Home_type = result.home_type Zestimate = result.zestimate_amount zillow_id = result.zillow_id lat = str(result.latitude) long_res = str(result.longitude) num_bath = str(result.bathrooms) num_bed = str(result.bedrooms) home_size = str(result.home_size) #######CALL TO UPDATED HOME DETAILS zillow_data = ZillowWrapper(zws_id) updated_property_details_response = zillow_data.get_updated_property_details( zillow_id) result = GetUpdatedPropertyDetails( updated_property_details_response) photo_gall = result.photo_gallery home_d = result.home_description write_out = street_address + '|' + zipcode + "|" + zillow_id + "|" + Zestimate + "|" + num_bath + "|" + num_bed + "|" + lat + "|" + long_res + "\n" print(str(write_out)) data_base.write(write_out) x += 1 except: print("Nothing Added") #f_name.close() data_base.close()
def test_zillow_api_connect(self): # create response from zillow and check for error code '0' zillow_data = ZillowWrapper(self.ZILLOW_API_KEY) zillow_search_response = zillow_data.get_deep_search_results( self.address, self.zipcode) assert \ zillow_search_response.find('message').find('code').text == '0'
def make_predict(): # read in data lines = request.get_json(force=True) address = lines['address'] city = lines['city'] state = lines['state'] zipcode = lines['zipcode'] bed = lines['bed'] bath = lines['bath'] SqFt = lines['SqFt'] year = lines['year'] # generate prediction using pickled model input = np.array([[bath, bed, SqFt, year, zipcode]]) prediction = model.predict(input) output = list(prediction[0])[0] # compare against zillow model zillow_data = ZillowWrapper(API_KEY_HERE) deep_search_response = zillow_data.get_deep_search_results( address, zipcode) result = GetDeepSearchResults(deep_search_response) output2 = result.zestimate_amount op = list([int(output), int(output2)]) return jsonify(results=op)
def search(self, query): address, zipcode = query.rsplit(" ", 1) data = ZillowWrapper("X1-ZWz19cu0z5xn9n_17jma") response = data.get_deep_search_results(address, zipcode) return GetDeepSearchResults(response)
def get_property_info(address, zipcode): if address and zipcode: zillow_data = ZillowWrapper(ZILLOW_API_KEY) deep_search_response = zillow_data.get_deep_search_results( address, zipcode) result = GetDeepSearchResults(deep_search_response) return result
def make_predict(): lines = request.get_json(force=True) # was 'data' # predict_request = [data['address'], data['city'], data['state'], # data['zipcode'], data['bed'], data['bath'], data['SqFt'], # data['SqFt']] # predict_request = [np.array(predict_request)] # y_hat = reg.predict(predict_request) address = lines['address'] city = lines['city'] state = lines['state'] zipcode = lines['zipcode'] bed = lines['bed'] bath = lines['bath'] SqFt = lines['SqFt'] year = lines['year'] test_case = np.array([[bath, bed, SqFt, year, zipcode]]) reg.predict(test_case) prediction = reg.predict(test_case) output = list(prediction[0])[0] #return jsonify(results=address) zillow_data = ZillowWrapper('X1-ZWz1gyajrkda8b_76gmj') deep_search_response = zillow_data.get_deep_search_results(address,zipcode) result = GetDeepSearchResults(deep_search_response) output2 = result.zestimate_amount op = list([int(output),int(output2)]) return jsonify(results=op)
def test_zillow_error_missing_zipcode(self): # This test checks the correct error message if no zipcode is provided. # Expected error code: 501 zillow_data = ZillowWrapper(self.ZILLOW_API_KEY) raises(ZillowError, zillow_data.get_deep_search_results, address=self.address, zipcode=None)
def test_zillow_error_invalid_ZWSID(self): # This test checks the correct error message if no ZWSID is provided. # Expected error code: 2 zillow_data = ZillowWrapper(None) raises(ZillowError, zillow_data.get_deep_search_results, address=self.address, zipcode=self.zipcode)
def get_summary(address, zipcode): with open('/Users/pjadzinsky/.zillow') as f: key = f.read().replace('\n', '') zillow_data = ZillowWrapper(key) response = zillow_data.get_deep_search_results(address, zipcode) result = GetDeepSearchResults(response) return result
def test_zillow_api_connect(self): set_get_deep_search_response( self.api_response_obj.get("get_deep_search_200_ok")) zillow_data = ZillowWrapper(self.ZILLOW_API_KEY) zillow_search_response = zillow_data.get_deep_search_results( self.address, self.zipcode) assert zillow_search_response.find("message").find("code").text == "0"
def deep_search(): cnxt = db.connect(user="******", password="******", host="localhost", database="sys", charset="utf8mb4") cursor = cnxt.cursor() cursor.execute("SELECT Address FROM PySpider") data = cursor.fetchall() A = [" ".join(j) for j in [i[0].split()[:-1] for i in data]] Z = [" ".join(j) for j in [i[0].split()[-1:] for i in data]] API = ZillowWrapper('X1-ZWz1gtmiat11xn_7ew1d') progbar = tqdm(total=len(A)) for i in range(len(A)): progbar.update(1) try: response = API.get_deep_search_results(A[i], Z[i]) result = GetDeepSearchResults(response) zestimate_amount = result.zestimate_amount address = A[i] zipcode = Z[i] home_type = result.home_type home_size = result.home_size property_size = result.property_size bedrooms = result.bedrooms bathrooms = result.bathrooms last_sold_price = result.last_sold_price last_sold_date = result.last_sold_date zestimate_last_updated = result.zestimate_last_updated zestimate_value_change = result.zestimate_value_change zestimate_percentile = result.zestimate_percentile zestimate_valuation_range_high = result.zestimate_valuation_range_high zestimate_valuationRange_low = result.zestimate_valuationRange_low year_built = result.year_built home_detail_link = result.home_detail_link query = "INSERT INTO PyZillow (zestimate_amount, address, zipcode, home_type, home_size,\ property_size, bedrooms, bathrooms, last_sold_price, last_sold_date,\ zestimate_last_updated, zestimate_value_change, zestimate_percentile,\ zestimate_valuation_range_high, zestimate_valuationRange_low, year_built,\ home_detail_link) VALUES (%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s)" cursor.execute( query, (zestimate_amount, address, zipcode, home_type, home_size, property_size, bedrooms, bathrooms, last_sold_price, last_sold_date, zestimate_last_updated, zestimate_value_change, zestimate_percentile, zestimate_valuation_range_high, zestimate_valuationRange_low, year_built, home_detail_link)) cnxt.commit() except: continue progbar.close() return
def test_zillow_error_match_zipcode_city(self): # This test checks the correct error message if no zipcode is provided. # Expected error code: 503 mismatch_zipcode = '97204' # Portland, OR zillow_data = ZillowWrapper(self.ZILLOW_API_KEY) raises(ZillowError, zillow_data.get_deep_search_results, address=self.address, zipcode=mismatch_zipcode)
def __init__(self, zillow_api_key): if os.path.isfile(ZILLOW_RATE_LIMITER_FILE): self.rate_limiter = RequestRateLimiter.fromFile( ZILLOW_RATE_LIMITER_FILE) else: self.rate_limiter = RequestRateLimiter( max_requests=ZILLOW_QUOTA_MAX_REQUESTS, time_interval=ZILLOW_QUOTA_TIME_INTERVAL, state_file=ZILLOW_RATE_LIMITER_FILE) self.zillow_wrapper = ZillowWrapper(zillow_api_key)
def test_zillow_error_invalid_zipcode(self): # This test checks the correct error message if an # invalid zipcode is provided. # Expected error code: 503 invalid_zipcode = 'ABCDE' # invalid zipcode zillow_data = ZillowWrapper(self.ZILLOW_API_KEY) raises(ZillowError, zillow_data.get_deep_search_results, address=self.address, zipcode=invalid_zipcode)
def get_home_description(address, zipcode): ZILLOW_API_KEY = "X1-ZWz1fssph6dr7v_2hwdv" zillow_data = ZillowWrapper(ZILLOW_API_KEY) # YOUR_ZILLOW_API_KEY deep_search_response = zillow_data.get_deep_search_results(address, zipcode) result = GetDeepSearchResults(deep_search_response) updated_property_details_response = zillow_data.get_updated_property_details(result.zillow_id) result_details = GetUpdatedPropertyDetails(updated_property_details_response) return result_details.get_attr("home_description")
def zillow_query(key, address, citystatezip): zillow = [] zillow_data = ZillowWrapper(key) deep_search_response = zillow_data.get_deep_search_results( address, citystatezip) result = GetDeepSearchResults(deep_search_response) #Print the results of the query return result
def test_zillow_error_no_coverage(self): # This test checks the correct error message # if no coverage is provided. # Expected error code: 504 address = 'Calle 21 y O, Vedado, Plaza, Ciudad de la Habana, Cuba' zipcode = '10400' # Cuban address, I assume Zillow doesn't cover Cuba zillow_data = ZillowWrapper(self.ZILLOW_API_KEY) raises(ZillowError, zillow_data.get_deep_search_results, address=address, zipcode=zipcode)
def test_zillow_error_no_property_match(self): # This test checks the correct error message if no property is found. # Expected error code: 508 # Address and zip code of an exisiting property, but not listed address = '599 Pennsylvania Avenue Northwest, Washington, DC' zipcode = '20001' zillow_data = ZillowWrapper(self.ZILLOW_API_KEY) raises(ZillowError, zillow_data.get_deep_search_results, address=address, zipcode=zipcode)
def queryAndExtractFeatures(inputs, code): results = {} for address, zipcode in inputs: zillow_data = ZillowWrapper(code) try: deep_search_response = zillow_data.get_deep_search_results( address, zipcode) result = GetDeepSearchResults(deep_search_response) results[(address, zipcode)] = extractFeatures(result) + [zipcode] except: continue return results
def zillow_query(address, zipcode): ''' Given an address and zipcode as strings returns id, zestimate (or last sold price if zestimate unavilable), and latest tax appraisal value ''' zillow_data = ZillowWrapper(keys.zillow['api_key']) deep_search_response = zillow_data.get_deep_search_results( address, zipcode) result = GetDeepSearchResults(deep_search_response) if result.zestimate_amount == None: return result.last_sold_price else: return result.zillow_id, result.zestimate_amount, result.tax_value
def test_get_updated_property_details_results(self): """ """ zillow_id = '48749425' responses.add( responses.GET, 'http://www.zillow.com/webservice/GetUpdatedPropertyDetails.htm', body= '<?xml version="1.0" encoding="utf-8"?><UpdatedPropertyDetails:updatedPropertyDetails xmlns:UpdatedPropertyDetails="http://www.zillow.com/static/xsd/UpdatedPropertyDetails.xsd" xsi:schemaLocation="http://www.zillow.com/static/xsd/UpdatedPropertyDetails.xsd http://www.zillowstatic.com/vstatic/34794f0/static/xsd/UpdatedPropertyDetails.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><request><zpid>48749425</zpid></request><message><text>Request successfully processed</text><code>0</code></message><response><zpid>48749425</zpid><pageViewCount><currentMonth>16125</currentMonth><total>16125</total></pageViewCount><address><street>2114 Bigelow Ave N</street><zipcode>98109</zipcode><city>Seattle</city><state>WA</state><latitude>47.637933</latitude><longitude>-122.347938</longitude></address><links><homeDetails>http://www.zillow.com/homedetails/2114-Bigelow-Ave-N-Seattle-WA-98109/48749425_zpid/</homeDetails><photoGallery>http://www.zillow.com/homedetails/2114-Bigelow-Ave-N-Seattle-WA-98109/48749425_zpid/#image=lightbox%3Dtrue</photoGallery><homeInfo>http://www.zillow.com/homedetails/2114-Bigelow-Ave-N-Seattle-WA-98109/48749425_zpid/</homeInfo></links><images><count>1</count><image><url>http://photos3.zillowstatic.com/p_d/ISxb3qa8s1cwx01000000000.jpg</url></image></images><editedFacts><useCode>SingleFamily</useCode><bedrooms>4</bedrooms><bathrooms>3.0</bathrooms><finishedSqFt>3470</finishedSqFt><lotSizeSqFt>4680</lotSizeSqFt><yearBuilt>1924</yearBuilt><yearUpdated>2003</yearUpdated><numFloors>2</numFloors><basement>Finished</basement><roof>Composition</roof><view>Water, City, Mountain</view><parkingType>Off-street</parkingType><heatingSources>Gas</heatingSources><heatingSystem>Forced air</heatingSystem><rooms>Laundry room, Walk-in closet, Master bath, Office, Dining room, Family room, Breakfast nook</rooms></editedFacts><neighborhood>Queen Anne</neighborhood><schoolDistrict>Seattle</schoolDistrict><elementarySchool>John Hay</elementarySchool><middleSchool>McClure</middleSchool></response></UpdatedPropertyDetails:updatedPropertyDetails><!-- H:001 T:127ms S:990 R:Sat Sep 12 23:47:31 PDT 2015 B:4.0.19615-release_20150908-endor.2fa5797~candidate.358c83d -->', content_type='application/xml', status=200) zillow_data = ZillowWrapper(api_key=None) updated_property_details_response = \ zillow_data.get_updated_property_details(zillow_id) result = GetUpdatedPropertyDetails(updated_property_details_response) assert result.zillow_id == '48749425' assert result.home_type == 'SingleFamily' assert result.home_detail_link == \ 'http://www.zillow.com/homedetails/' + \ '2114-Bigelow-Ave-N-Seattle-WA-98109/48749425_zpid/' assert result.photo_gallery == \ 'http://www.zillow.com/homedetails/' + \ '2114-Bigelow-Ave-N-Seattle-WA-98109/' + \ '48749425_zpid/#image=lightbox%3Dtrue' assert result.home_info == \ 'http://www.zillow.com/homedetails/' + \ '2114-Bigelow-Ave-N-Seattle-WA-98109/48749425_zpid/' assert result.year_built == '1924' assert result.property_size == '4680' assert result.home_size == '3470' assert result.bathrooms == '3.0' assert result.bedrooms == '4' assert result.year_updated == '2003' assert result.basement == 'Finished' assert result.roof == 'Composition' assert result.view == 'Water, City, Mountain' assert result.heating_sources == 'Gas' assert result.heating_system == 'Forced air' assert result.rooms == \ 'Laundry room, Walk-in closet, Master bath, Office,' + \ ' Dining room, Family room, Breakfast nook' assert result.neighborhood == 'Queen Anne' assert result.school_district == 'Seattle' lat = float(result.latitude) assert lat - 0.01 <= 47.637933 <= lat + 0.01 lng = float(result.longitude) assert lng - 0.01 <= -122.347938 <= lng + 0.01 assert result.floor_material is None assert result.num_floors == '2' assert result.parking_type == 'Off-street'
def test_deep_search_results(self): """ """ address = '2114 Bigelow Ave Seattle, WA' zipcode = '98109' responses.add( responses.GET, 'http://www.zillow.com/webservice/GetDeepSearchResults.htm', body= '<?xml version="1.0" encoding="utf-8"?><SearchResults:searchresults xsi:schemaLocation="http://www.zillow.com/static/xsd/SearchResults.xsd http://www.zillowstatic.com/vstatic/34794f0/static/xsd/SearchResults.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SearchResults="http://www.zillow.com/static/xsd/SearchResults.xsd"><request><address>2114 Bigelow Ave Seattle, WA</address><citystatezip>98109</citystatezip></request><message><text>Request successfully processed</text><code>0</code></message><response><results><result><zpid>48749425</zpid><links><homedetails>http://www.zillow.com/homedetails/2114-Bigelow-Ave-N-Seattle-WA-98109/48749425_zpid/</homedetails><graphsanddata>http://www.zillow.com/homedetails/2114-Bigelow-Ave-N-Seattle-WA-98109/48749425_zpid/#charts-and-data</graphsanddata><mapthishome>http://www.zillow.com/homes/48749425_zpid/</mapthishome><comparables>http://www.zillow.com/homes/comps/48749425_zpid/</comparables></links><address><street>2114 Bigelow Ave N</street><zipcode>98109</zipcode><city>Seattle</city><state>WA</state><latitude>47.637933</latitude><longitude>-122.347938</longitude></address><FIPScounty>53033</FIPScounty><useCode>SingleFamily</useCode><taxAssessmentYear>2014</taxAssessmentYear><taxAssessment>1060000.0</taxAssessment><yearBuilt>1924</yearBuilt><lotSizeSqFt>4680</lotSizeSqFt><finishedSqFt>3470</finishedSqFt><bathrooms>3.0</bathrooms><bedrooms>4</bedrooms><lastSoldDate>11/26/2008</lastSoldDate><lastSoldPrice currency="USD">1025000</lastSoldPrice><zestimate><amount currency="USD">1419804</amount><last-updated>09/10/2015</last-updated><oneWeekChange deprecated="true"></oneWeekChange><valueChange duration="30" currency="USD">20690</valueChange><valuationRange><low currency="USD">1292022</low><high currency="USD">1547586</high></valuationRange><percentile>0</percentile></zestimate><localRealEstate><region name="East Queen Anne" id="271856" type="neighborhood"><zindexValue>629,900</zindexValue><links><overview>http://www.zillow.com/local-info/WA-Seattle/East-Queen-Anne/r_271856/</overview><forSaleByOwner>http://www.zillow.com/east-queen-anne-seattle-wa/fsbo/</forSaleByOwner><forSale>http://www.zillow.com/east-queen-anne-seattle-wa/</forSale></links></region></localRealEstate></result></results></response></SearchResults:searchresults><!-- H:003 T:27ms S:1181 R:Sat Sep 12 23:30:47 PDT 2015 B:4.0.19615-release_20150908-endor.2fa5797~candidate.358c83d -->', content_type='application/xml', status=200) zillow_data = ZillowWrapper(api_key=None) deep_search_response = zillow_data.get_deep_search_results( address, zipcode) result = GetDeepSearchResults(deep_search_response) assert result.zillow_id == '48749425' assert result.home_type == 'SingleFamily' assert result.home_detail_link == \ 'http://www.zillow.com/homedetails/' + \ '2114-Bigelow-Ave-N-Seattle-WA-98109/48749425_zpid/' assert result.graph_data_link == \ 'http://www.zillow.com/homedetails/' + \ '2114-Bigelow-Ave-N-Seattle-WA-98109/' + \ '48749425_zpid/#charts-and-data' assert result.map_this_home_link == \ 'http://www.zillow.com/homes/48749425_zpid/' assert result.tax_year == '2014' assert result.tax_value == '1060000.0' assert result.year_built == '1924' assert result.property_size == '4680' assert result.home_size == '3470' assert result.bathrooms == '3.0' assert result.bedrooms == '4' assert result.last_sold_date == '11/26/2008' assert result.last_sold_price_currency == 'USD' assert result.last_sold_price == '1025000' lat = float(result.latitude) assert lat - 0.01 <= 47.637933 <= lat + 0.01 lng = float(result.longitude) assert lng - 0.01 <= -122.347938 <= lng + 0.01 assert result.zestimate_amount == '1419804' # assert result.zestimate_currency == 'USD' assert result.zestimate_last_updated == '09/10/2015' assert result.zestimate_value_change == '20690' assert result.zestimate_valuation_range_high == '1547586' assert result.zestimate_valuation_range_low == '1292022' assert result.zestimate_percentile == '0'
def call_zillow_api(address, zipcode): #YOUR_ZILLOW_API_KEY = 'X1-ZWz1ffghcdgzkb_a80zd' #[email protected] YOUR_ZILLOW_API_KEY = 'X1-ZWz19ktnpd1lor_67ceq' #[email protected] zillow_data = ZillowWrapper(YOUR_ZILLOW_API_KEY) try: deep_search_response = zillow_data.get_deep_search_results( address, zipcode) result = GetDeepSearchResults(deep_search_response) print 'User input zillow_id = {}'.format(result.zillow_id) except: result = -9999 return result
def getZillowData(address="1600 Pennsylvania Avenue NW", zipcode="20500"): global g_MyApiKey webResponse = "" zillowData = ZillowWrapper(g_MyApiKey) webResponse = zillowData.get_deep_search_results(address, zipcode) result = GetDeepSearchResults(webResponse) print(result.zestimate_percentile) return result
def test_zillow_error_invalid_ZWSID(self): """ This test checks the correct error message if no ZWSID is provided. Expected error code: 2 """ set_get_deep_search_response( self.api_response_obj.get("error_2_zwsid_missing")) zillow_data = ZillowWrapper(None) with pytest.raises(ZillowError) as excinfo: zillow_data.get_deep_search_results(address=self.address, zipcode=None) error_msg = "Status 2: The specified ZWSID parameter was invalid" assert error_msg in str(excinfo.value)
def test_zillow_error_missing_zipcode(self): """ This test checks the correct error message if no zipcode is provided. Expected error code: 501 """ set_get_deep_search_response( self.api_response_obj.get("error_501_no_city_state")) zillow_data = ZillowWrapper(self.ZILLOW_API_KEY) with pytest.raises(ZillowError) as excinfo: zillow_data.get_deep_search_results(address=self.address, zipcode=None) error_msg = "Status 501: Invalid or missing citystatezip parameter" assert error_msg in str(excinfo.value)
def get_zillow_data(addr_list, zip_list): meta = "https://maps.googleapis.com/maps/api/streetview/metadata?" base = "https://maps.googleapis.com/maps/api/streetview?size=1200x800&" myloc = "C:\\Users\\sumukh210991\\Desktop\\Study\\Thesis\\popularity_score_for_houses\\python\\img" key = "&key=" + "AIzaSyC7-APuKb-aknoKymJdflh2jTC91HBe8rY" data = [] count = 4960 # 4959 for i in range(0, len(addr_list)): address = addr_list[i] zipcode = zip_list[i] zillow_data = ZillowWrapper("X1-ZWz1fpv5bng2rv_799rh" ) # nishant_masc 'X1-ZWz19gfhe5z8y3_8xo7s' # nishant:'X1-ZWz1fk2vm7fkln_8tgid'; # sumukh: 'X1-ZWz1fijmr1w9hn_9fxlx'; # Sumukh@sdsu: 'X1-ZWz19anfkueyob_77v70'; # other: 'X1-ZWz1fpv5bng2rv_799rh'; try: deep_search_response = zillow_data.get_deep_search_results( address, zipcode) result = GetDeepSearchResults(deep_search_response) loc = str(result.latitude) + "," + str(result.longitude) print(loc) params = { "location": loc, "width": "600", "height": "400", "key": "AIzaSyC7-APuKb-aknoKymJdflh2jTC91HBe8rY", "fov": "90", "pitch": "0", "heading": "1" } metaurl = meta + urllib.urlencode(params) MyUrl = base + urllib.urlencode(params) file_loc = "img/file" + (str(count)) + ".png" print(file_loc) status = requests.get(metaurl) if ("ZERO_RESULTS" in str(status.content)): print("NO CONTENT") continue else: count = count + 1 res = urllib.urlretrieve(MyUrl, os.path.join(file_loc)) data.append(result) except: # data.append("none") continue return (data)
def test_zillow_error_account_not_authorized(self): """ This test checks for account not authorized error Expected error code: 6 """ set_get_deep_search_response( self.api_response_obj.get("error_6_account_not_authorized")) zillow_data = ZillowWrapper(self.ZILLOW_API_KEY) with pytest.raises(ZillowError) as excinfo: zillow_data.get_deep_search_results(address=self.address, zipcode=self.zipcode) error_msg = "Status 6: This account is not authorized to execute this API call" assert error_msg in str(excinfo.value)
def test_get_updated_property_details_results(self): """ Tests parsing of updated_property_details results """ zillow_id = "48749425" set_updated_property_details_response( self.api_response_obj.get("updated_property_details_200_ok")) zillow_data = ZillowWrapper(api_key=None) updated_property_details_response = zillow_data.get_updated_property_details( zillow_id) result = GetUpdatedPropertyDetails(updated_property_details_response) assert result.zillow_id == "48749425" assert result.home_type == "SingleFamily" assert ( result.home_detail_link == "http://www.zillow.com/homedetails/" + "2114-Bigelow-Ave-N-Seattle-WA-98109/48749425_zpid/") assert (result.photo_gallery == "http://www.zillow.com/homedetails/" + "2114-Bigelow-Ave-N-Seattle-WA-98109/" + "48749425_zpid/#image=lightbox%3Dtrue") assert (result.home_info == "http://www.zillow.com/homedetails/" + "2114-Bigelow-Ave-N-Seattle-WA-98109/48749425_zpid/") assert result.year_built == "1924" assert result.property_size == "4680" assert result.home_size == "3470" assert result.bathrooms == "3.0" assert result.bedrooms == "4" assert result.year_updated == "2003" assert result.basement == "Finished" assert result.roof == "Composition" assert result.view == "Water, City, Mountain" assert result.heating_sources == "Gas" assert result.heating_system == "Forced air" assert (result.rooms == "Laundry room, Walk-in closet, Master bath, Office," + " Dining room, Family room, Breakfast nook") assert result.neighborhood == "Queen Anne" assert result.school_district == "Seattle" lat = float(result.latitude) assert lat - 0.01 <= 47.637933 <= lat + 0.01 lng = float(result.longitude) assert lng - 0.01 <= -122.347938 <= lng + 0.01 assert result.floor_material is None assert result.num_floors == "2" assert result.parking_type == "Off-street"
def test_deep_search_results(self): """ Tests parsing of deep_search results """ address = "2114 Bigelow Ave Seattle, WA" zipcode = "98109" set_get_deep_search_response( self.api_response_obj.get("get_deep_search_200_ok")) zillow_data = ZillowWrapper(api_key=None) deep_search_response = zillow_data.get_deep_search_results( address, zipcode) result = GetDeepSearchResults(deep_search_response) assert result.zillow_id == "48749425" assert result.home_type == "SingleFamily" assert ( result.home_detail_link == "http://www.zillow.com/homedetails/" + "2114-Bigelow-Ave-N-Seattle-WA-98109/48749425_zpid/") assert ( result.graph_data_link == "http://www.zillow.com/homedetails/" + "2114-Bigelow-Ave-N-Seattle-WA-98109/" + "48749425_zpid/#charts-and-data") assert result.map_this_home_link == "http://www.zillow.com/homes/48749425_zpid/" assert result.tax_year == "2018" assert result.tax_value == "1534000.0" assert result.year_built == "1924" assert result.property_size == "4680" assert result.home_size == "3470" assert result.bathrooms == "3.0" assert result.bedrooms == "4" assert result.last_sold_date == "11/26/2008" assert result.last_sold_price_currency == "USD" assert result.last_sold_price == "995000" lat = float(result.latitude) assert lat - 0.01 <= 47.637933 <= lat + 0.01 lng = float(result.longitude) assert lng - 0.01 <= -122.347938 <= lng + 0.01 assert result.zestimate_amount == "2001121" # assert result.zestimate_currency == 'USD' assert result.zestimate_last_updated == "05/28/2020" assert result.zestimate_value_change == "-16739" assert result.zestimate_valuation_range_high == "2121188" assert result.zestimate_valuation_range_low == "1881054" assert result.zestimate_percentile == "0"