如何获取我的api脚本以读取csv中的列标题并通过zillow api提供搜索结果?

时间:2019-07-15 16:13:04

标签: python api dataframe zillow

import pyzillow
from pyzillow.pyzillow import ZillowWrapper, GetDeepSearchResults
import pandas as pd

api_key = 'mykey'
house = pd.read_csv('sample3.csv')
def get_deep_search_results(self, address, zipcode):
    """
    GetDeepSearchResults API
    """

    url = 'http://www.zillow.com/webservice/GetDeepSearchResults.htm'
    params = {
        'address': address,
        'citystatezip': zipcode,
        'zws-id': self.api_key,
        'rentzestimate': True # This is the only line we add
    }
    return self.get_data(url, params)

zillow_data = ZillowWrapper('X1-ZWz1835knufc3v_38l6u')
deep_search_response = zillow_data.get_deep_search_results(address, zip_code)
result = GetDeepSearchResults(deep_search_response)

print(result)

嗨,我正在尝试让脚本命中如下所示的csv文件: head(house)

AccountId                    Street        City State ZipCode    ABC DEF ZipHhIncome ZipPctAdvDegree
1    465XYZ            509 Ventura Ct Suisun City    CA   94585            0.8         2.75       70491      0.04138845
2    45ZYZ 20235 North Cave Creek Rd     Phoenix    AZ   85024            0.9         2.50       68557      0.12165522
3    485BBB           371 50th Street     Oakland    CA   94609            0.8         2.75       67827      0.22325981
4    454BYB       1028 Florida Street     Vallejo    CA   94590            0.8         2.25       41530      0.05690732
5    439GGG          35 Linden Avenue  Long Beach    CA   90802            0.8         2.25       45689      0.15401013
6    461FFF          106 Harrison Ave   Tonawanda    NY   14223            1.2         2.25       60632      0.18493314

由于某些原因,我的代码无法解析地址状态和zip(它们是检索我在输出中所需的搜索结果的参数)

0 个答案:

没有答案
相关问题