Modules Documentation

pyzillow.pyzillow module

The ZillowWrapper class

class pyzillow.pyzillow.ZillowWrapper(api_key: str = None)[source]

This class provides an interface into the Zillow API. An API key is required to create an instance of this class:

>>> from pyzillow.pyzillow import ZillowWrapper
>>> zillow_data = ZillowWrapper(YOUR_ZILLOW_API_KEY)

To request data from Zillow, you can choose between:

  1. The GetDeepSearchResults API endpoint (pyzillow.pyzillow.GetDeepSearchResults) which requires the following arguments:

    • A street address (e.g. '2114 Bigelow Ave')
    • A ZIP code or city and state combination (e.g. '98109' or 'Seattle, WA')
    • Optional: Enabling or disabling Zillow Rentzestimate information in API results (True/False)

    Example:

    >>> from pyzillow.pyzillow import ZillowWrapper, GetDeepSearchResults
    >>> zillow_data = ZillowWrapper(YOUR_ZILLOW_API_KEY)
    >>> deep_search_response = zillow_data.get_deep_search_results(address,
                                                                   zipcode,
                                                                   rentzestimate)
    >>> result = GetDeepSearchResults(deep_search_response)
    
  2. The GetUpdatedPropertyDetails API endpoint (pyzillow.pyzillow.GetUpdatedPropertyDetails) which requires a Zillow Property ID (ZPID) as an argument. You can acquire this identifier by accessing .zillow_id from a pyzillow.pyzillow.GetDeepSearchResults object. GetUpdatedPropertyDetails data is not available for all valid Zillow IDs.

    Example:

    >>> from pyzillow.pyzillow import ZillowWrapper, GetUpdatedPropertyDetails
    >>> zillow_data = ZillowWrapper(YOUR_ZILLOW_API_KEY)
    >>> updated_property_details_response =                 zillow_data.get_updated_property_details(zillow_id)
    >>> result = GetUpdatedPropertyDetails(updated_property_details_response)
    
get_data(url: str, params: dict)[source]

This method requests data from the API endpoint specified in the url argument. It uses parameters from the params argument.

Parameters:
  • url (str) – URL of API endpoint
  • params (dict) – Parameters for API query
Raises:
  • ZillowFail – The API endpoint could not be reached or the request did not return valid XML
  • ZillowError – The API endpoint responded with an error code
  • ZillowNoResults – The request did not return any results
Returns:

Result from API query

Return type:

xml.etree.ElementTree.Element

get_deep_search_results(address: str, zipcode: str, rentzestimate: bool = False)[source]

This method provides results from the GetDeepSearchResults API endpoint as an XML object.

Parameters:
  • address (str) – Street address to look up
  • zipcode (str) – ZIP code to look up
  • rentzestimate (bool, optional) – Add Rent Zestimate information to result (True/False), defaults to False
Returns:

Result from API query

Return type:

xml.etree.ElementTree.Element

get_updated_property_details(zpid: str)[source]

This method provides results from the GetUpdatedPropertyDetails API endpoint as an XML object.

Parameters:zpid (str) – Zillow Web Service Identifier
Returns:Result from API query
Return type:xml.etree.ElementTree.Element

The GetDeepSearchResults class

class pyzillow.pyzillow.GetDeepSearchResults(data, *args, **kwargs)[source]

Bases: pyzillow.pyzillow.ZillowResults

Maps results from the XML data array into attributes of an instance of GetDeepSearchResults.

An instance of GetDeepSearchResults has the following attributes: .bathrooms .bedrooms .city .fips_county .graph_data_link .home_detail_link .home_size .home_type .last_sold_date .last_sold_price .latitude .longitude .map_this_home_link .property_size .rentzestimate_amount .rentzestimate_last_updated .rentzestimate_valuation_range_high .rentzestimate_valuation_range_low .rentzestimate_value_change .state .street .tax_value .tax_year .total_rooms .use_code .year_built .zestimate_amount .zestimate_last_updated .zestimate_percentile .zestimate_valuation_range_high .zestimate_valuation_range_low .zestimate_value_change .zillow_id .zipcode

The GetUpdatedPropertyDetails class

class pyzillow.pyzillow.GetUpdatedPropertyDetails(data, *args, **kwargs)[source]

Bases: pyzillow.pyzillow.ZillowResults

Maps results from the XML data array into attributes of an instance of GetUpdatedPropertyDetails.

An instance of GetUpdatedPropertyDetails has the following attributes: .agent_name .agent_profile_url .appliances .basement .bathrooms .bedrooms .brokerage .city .cooling_system .elementary_school .exterior_material .floor_material .heating_sources .heating_system .high_school .home_description .home_detail_link .home_info .home_size .home_type .latitude .longitude .middle_school .neighborhood .num_floors .num_rooms .page_view_count_this_month .page_view_count_total .parking_type .photo_gallery .posting_agent .posting_last_update .posting_mls .posting_status .posting_type .price .property_size .roof .rooms .school_district .state .street .view .year_built .year_updated .zillow_id .zipcode

pyzillow.pyzillowerrors module

exception pyzillow.pyzillowerrors.ZillowError(status, url=None, response=None)[source]

Bases: Exception

A ZillowError exception is raised if the API endpoint responded with an error code (http://www.zillow.com/howto/api/GetDeepSearchResults.htm).

exception pyzillow.pyzillowerrors.ZillowFail[source]

Bases: Exception

A ZillowFail exception is raised if the API endpoint could not be reached or the request did not return valid XML.

exception pyzillow.pyzillowerrors.ZillowNoResults[source]

Bases: Exception

A ZillowNoResults exception is raised if the request did not return any results.