| 8 | |
| 9 | |
| 10 | def build_tool(config) -> Tool: |
| 11 | tool = Tool( |
| 12 | "Real Estate Information", |
| 13 | "Look up rental and housing information", |
| 14 | name_for_model="Zillow", |
| 15 | description_for_model="Plugin for look up real estate information", |
| 16 | logo_url="https://your-app-url.com/.well-known/logo.png", |
| 17 | contact_email="hello@contact.com", |
| 18 | legal_info_url="hello@legal.com" |
| 19 | ) |
| 20 | |
| 21 | BASE_URL = "https://zillow-com1.p.rapidapi.com" |
| 22 | KEY = config["subscription_key"] |
| 23 | HEADERS = { |
| 24 | "X-RapidAPI-Key": KEY, |
| 25 | "X-RapidAPI-Host": "zillow-com1.p.rapidapi.com" |
| 26 | } |
| 27 | |
| 28 | |
| 29 | @tool.get("/search_properties") |
| 30 | def search_properties(location: str, page: Optional[int] = None, status_type: Optional[str] = None, |
| 31 | home_type: Optional[str] = None, sort: Optional[str] = None, polygon: Optional[str] = None, |
| 32 | minPrice: Optional[float] = None, maxPrice: Optional[float] = None, |
| 33 | rentMinPrice: Optional[float] = None, rentMaxPrice: Optional[float] = None, |
| 34 | bathsMin: Optional[int] = None, bathsMax: Optional[int] = None, |
| 35 | bedsMin: Optional[int] = None, bedsMax: Optional[int] = None, |
| 36 | sqftMin: Optional[int] = None, sqftMax: Optional[int] = None, |
| 37 | buildYearMin: Optional[int] = None, buildYearMax: Optional[int] = None, |
| 38 | daysOn: Optional[str] = None, soldInLast: Optional[str] = None, |
| 39 | isBasementFinished: Optional[int] = None, isBasementUnfinished: Optional[int] = None, |
| 40 | isPendingUnderContract: Optional[int] = None, isAcceptingBackupOffers: Optional[int] = None, |
| 41 | isComingSoon: Optional[bool] = None, otherListings: Optional[int] = None, |
| 42 | isNewConstruction: Optional[bool] = None, keywords: Optional[str] = None, |
| 43 | lotSizeMin: Optional[str] = None, lotSizeMax: Optional[str] = None, |
| 44 | saleByAgent: Optional[str] = None, saleByOwner: Optional[str] = None, |
| 45 | isForSaleForeclosure: Optional[bool] = None, isWaterfront: Optional[bool] = None, |
| 46 | hasPool: Optional[bool] = None, hasAirConditioning: Optional[bool] = None, |
| 47 | isCityView: Optional[bool] = None, isMountainView: Optional[bool] = None, |
| 48 | isWaterView: Optional[bool] = None, isParkView: Optional[bool] = None, |
| 49 | isOpenHousesOnly: Optional[bool] = None, is3dHome: Optional[bool] = None, |
| 50 | coordinates: Optional[str] = None, hoa: Optional[float] = None, |
| 51 | includeHomesWithNoHoaData: Optional[bool] = None, isAuction: Optional[bool] = None): |
| 52 | |
| 53 | """ |
| 54 | Function to search properties based on a set of parameters. |
| 55 | |
| 56 | Parameters: |
| 57 | location (str): Location details, address, county, neighborhood or Zip code. |
| 58 | page (int): Page number if at the previous response totalPages > 1. |
| 59 | status_type (str): Status type of the property. |
| 60 | home_type (str): Type of the home. |
| 61 | sort (str): Sorting option for the results. |
| 62 | polygon (str): Polygon coordinates for the search. |
| 63 | minPrice (float): Minimum price of the property. |
| 64 | maxPrice (float): Maximum price of the property. |
| 65 | rentMinPrice (float): Minimum rent price of the property. |
| 66 | rentMaxPrice (float): Maximum rent price of the property. |
| 67 | bathsMin (int): Minimum number of bathrooms. |