GithubHelp home page GithubHelp logo

redfin's Introduction

Python-Redfin

A wrapper around redfin's unofficial API. Anything on the redfin site can be accessed through this module without screen scraping.

Installation

$ python3 -m pip install redfin

Usage

from redfin import Redfin

client = Redfin()

address = '4544 Radnor St, Detroit Michigan'

response = client.search(address)
url = response['payload']['exactMatch']['url']
initial_info = client.initial_info(url)

property_id = initial_info['payload']['propertyId']
mls_data = client.below_the_fold(property_id)

listing_id = initial_info['payload']['listingId']
avm_details = client.avm_details(property_id, listing_id)

Usage Notes

  • sometimes below_the_fold lacks propertyHistoryInfo -- see #11 if this is needed

Documentation

See the file for all functions, pop open requests on redfin to see which one you want.

redfin's People

Contributors

dreed47 avatar leecook1 avatar reteps avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

redfin's Issues

sometimes below_the_fold lacks propertyHistoryInfo

Sometimes, the below_the_fold API call doesn't return a propertyHistoryInfo key. I speculate it's because this house is off-market.

response = Redfin().search("3947 Kings Row Reno Nevada")
url = response['payload']['exactMatch']['url']
initial_info = Redfin().initial_info(url)
property_id = initial_info['payload']['propertyId']
btf_data = Redfin().below_the_fold(property_id)
print(btf_data["payload"]["propertyHistoryInfo"])
Traceback (most recent call last):
  File "<console>", line 1, in <module>
KeyError: 'propertyHistoryInfo'

When I view the page on Redfin, the data is there.

I also tried to find this data in other API calls but couldn't find it.

Any help is appreciated!

403 Client Error: Forbidden for url

Hey @reteps , piggybacking on an issue that was raised in a different thread (but was closed due to inactivity from the submitter) since I'm getting the same '403 Client Error'.

I ran the command you suggest then and got this output:

{}&&{"version":463,"errorMessage":"Success","resultCode":0,"payload":{"sections":[{"rows":[{"id":"1_60973374","type":"1","name":"4544 Radnor St","subName":"Detroit, MI, USA","url":"/MI/Detroit/4544-Radnor-St-48224/home/60973374","urlV2":"/MI/Detroit/4544-Radnor-St-48224/home/60973374","active":true,"claimedHome":false,"invalidMRS":false,"businessMarketIds":[45],"countryCode":"US","hasRental":false}],"name":"Addresses"}],"exactMatch":{"id":"1_60973374","type":"1","name":"4544 Radnor St","subName":"Detroit, MI, USA","url":"/MI/Detroit/4544-Radnor-St-48224/home/60973374","urlV2":"/MI/Detroit/4544-Radnor-St-48224/home/60973374","active":true,"claimedHome":false,"invalidMRS":false,"businessMarketIds":[45],"countryCode":"US","hasRental":false},"extraResults":{},"responseTime":0,"hasFakeResults":false,"isGeocoded":false,"isRedfinServiced":false}}

Any insight would be greatly appreciated.

For context, I have a list of urls I was able to download directly from Redfin that looks at recently sold properties in our area with some filters put in place, with the aim of extracting some additional info I think would be really valuable for a predictive model I want to build (like list price since the downloadable data only provides sold price) to get a sense of what we should be bidding on houses as we gear up to enter the housing market in our area. Many thanks!

HTTPError: 403 Client Error: Forbidden for url: https://redfin.com/stingray/do/location-autocomplete?location=4544+Radnor+St%2C+Detroit+Michigan&v=2

from redfin import Redfin

client = Redfin()

address = '4544 Radnor St, Detroit Michigan'

response = client.search(address)
url = response['payload']['exactMatch']['url']
initial_info = client.initial_info(url)

property_id = initial_info['payload']['propertyId']
listing_id = initial_info['payload']['listingId']

mls_data = client.below_the_fold(property_id, listing_id)
---------------------------------------------------------------------------
HTTPError                                 Traceback (most recent call last)
<ipython-input-11-d6fe599d587c> in <module>()
      5 address = '4544 Radnor St, Detroit Michigan'
      6 
----> 7 response = client.search(address)
      8 url = response['payload']['exactMatch']['url']
      9 initial_info = client.initial_info(url)

2 frames
/usr/local/lib/python3.7/dist-packages/requests/models.py in raise_for_status(self)
    939 
    940         if http_error_msg:
--> 941             raise HTTPError(http_error_msg, response=self)
    942 
    943     def close(self):

HTTPError: 403 Client Error: Forbidden for url: https://redfin.com/stingray/do/location-autocomplete?location=4544+Radnor+St%2C+Detroit+Michigan&v=2

image_6487327 (1)

image_6487327

Get recent sales nearby a home

Dear reteps/redfin friends,

Thanks for building such nice github tool, starred !
Recently, we are trying to get recent sales nearby a home (such as recent sold withing the same zipcode), but we can not find required functions in the folder.

Maybe we miss something, hope to hear your expertise.

Best,
--Luke

RedFin Rate Limit

Looks like RedFin started limiting you after 30 requests, no matter how fast you are pulling data.

Any ideas?

Stingray documentation

Not an issue with the package, but I'm trying to track down the documentation for the Stingray API (like the kinds of requests I can make with it, and how to structure them) and there's basically nothing online.

As an example, I found a stackoverflow question regarding stingray's API where one can download a CSV of searches:

https://stackoverflow.com/questions/73200792/convert-redfins-region-id-to-a-zip-code

This request doesn't seem to be part of this package, which is totally fine, but it'd be cool to understand how to access it.

In short, what I am trying to do is a large pull of MLS data (specifically characteristics of a property, such as bed/bath, exterior condition - all stuff in the below_the_fold part of the package) and I am curious if there are easier ways to grab that information than my current, non-scalable solution which is to iterate through each of the properties I am interested in.

Ideally Redfin would just let me export this data, but I don't think they want to do that even if it is publicly available via webscraping and APIs!

Future of the module

Want to turn this module fully automatic, need some time to do it though.

[
  {
    "urlPath": "/stingray/do/api-get-header-user-menu",
    "method": "GET",
    "queryParams": [],
    "postParams": null,
    "type": "json"
  },
  {
    "urlPath": "/stingray/api/home/details/initialInfo",
    "method": "GET",
    "queryParams": [
      {
        "path": "/MI/Detroit/4544-Radnor-St-48224/home/60973374"
      }
    ],
    "postParams": null,
    "type": "json"
  },
  {
    "urlPath": "/stingray/api/home/details/v1/pagetagsinfo",
    "method": "GET",
    "queryParams": [
      {
        "path": "/MI/Detroit/4544-Radnor-St-48224/home/60973374"
      }
    ],
    "postParams": null,
    "type": "json"
  },
  {
    "urlPath": "/stingray/api/home/details/primaryRegionInfo",
    "method": "GET",
    "queryParams": [
      {
        "path": "/MI/Detroit/4544-Radnor-St-48224/home/60973374"
      }
    ],
    "postParams": null,
    "type": "json"
  },
  {
    "urlPath": "/stingray/corvair/v2/userData",
    "method": "GET",
    "queryParams": [],
    "postParams": null,
    "type": "json"
  },
  {
    "urlPath": "/stingray/api/home/details/aboveTheFold",
    "method": "GET",
    "queryParams": [
      {
        "propertyId": 60973374,
        "accessLevel": 1,
        "listingId": 124921811
      }
    ],
    "postParams": null,
    "type": "json"
  },
  {
    "urlPath": "/stingray/api/home/details/listing/floorplans",
    "method": "GET",
    "queryParams": [
      {
        "listingId": 124921811
      }
    ],
    "postParams": null,
    "type": "json"
  },
  {
    "urlPath": "/stingray/api/home/details/belowTheFold",
    "method": "GET",
    "queryParams": [
      {
        "propertyId": 60973374,
        "accessLevel": 1,
        "listingId": 124921811,
        "pageType": 5
      }
    ],
    "postParams": null,
    "type": "json"
  },
  {
    "urlPath": "/stingray/api/home/details/mainHouseInfoPanelInfo",
    "method": "GET",
    "queryParams": [
      {
        "propertyId": 60973374,
        "accessLevel": 1,
        "listingId": 124921811
      }
    ],
    "postParams": null,
    "type": "json"
  },
  {
    "urlPath": "/stingray/api/home/details/banner-data/p1",
    "method": "GET",
    "queryParams": [
      {
        "propertyId": 60973374,
        "accessLevel": 1,
        "listingId": 124921811
      }
    ],
    "postParams": null,
    "type": "json"
  },
  {
    "urlPath": "/stingray/api/home/details/avm",
    "method": "GET",
    "queryParams": [
      {
        "propertyId": 60973374,
        "accessLevel": 1,
        "listingId": 124921811
      }
    ],
    "postParams": null,
    "type": "json"
  },
  {
    "urlPath": "/stingray/api/home/details/descriptiveParagraph",
    "method": "GET",
    "queryParams": [
      {
        "propertyId": 60973374,
        "accessLevel": 1,
        "listingId": 124921811
      }
    ],
    "postParams": null,
    "type": "json"
  },
  {
    "urlPath": "/stingray/api/home/details/tourInsights",
    "method": "GET",
    "queryParams": [
      {
        "listingId": 124921811,
        "propertyId": 60973374,
        "accessLevel": 1,
        "pageType": 5
      }
    ],
    "postParams": null,
    "type": "json"
  },
  {
    "urlPath": "/stingray/api/home/details/neighborhoodStats/statsInfo",
    "method": "GET",
    "queryParams": [
      {
        "propertyId": 60973374,
        "accessLevel": 1,
        "listingId": 124921811,
        "regionId": 20559,
        "regionTypeId": 2
      }
    ],
    "postParams": null,
    "type": "json"
  },
  {
    "urlPath": "/stingray/api/home/details/hood-photos",
    "method": "GET",
    "queryParams": [
      {
        "propertyId": 60973374
      }
    ],
    "postParams": null,
    "type": "json"
  },
  {
    "urlPath": "/stingray/api/home/details/similars/listings",
    "method": "GET",
    "queryParams": [
      {
        "propertyId": 60973374,
        "accessLevel": 1,
        "listingId": 124921811,
        "marketId": 29
      }
    ],
    "postParams": null,
    "type": "json"
  },
  {
    "urlPath": "/stingray/api/home/details/similars/solds",
    "method": "GET",
    "queryParams": [
      {
        "propertyId": 60973374,
        "accessLevel": 1,
        "listingId": 124921811,
        "marketId": 29
      }
    ],
    "postParams": null,
    "type": "json"
  },
  {
    "urlPath": "/stingray/api/home/details/moreResourcesInfo",
    "method": "GET",
    "queryParams": [
      {
        "propertyId": 60973374
      }
    ],
    "postParams": null,
    "type": "json"
  },
  {
    "urlPath": "/stingray/api/home/details/propertyParcelInfo",
    "method": "GET",
    "queryParams": [
      {
        "listingId": 124921811,
        "propertyId": 60973374,
        "accessLevel": 1,
        "pageType": 5
      }
    ],
    "postParams": null,
    "type": "json"
  },
  {
    "urlPath": "/stingray/do/parcelstream/?sslAcct=true",
    "method": "GET",
    "queryParams": [],
    "postParams": null,
    "type": "json"
  },
  {
    "urlPath": "/stingray/api/home/details/activityInfo",
    "method": "GET",
    "queryParams": [
      {
        "propertyId": 60973374,
        "accessLevel": 1,
        "listingId": 124921811
      }
    ],
    "postParams": null,
    "type": "json"
  },
  {
    "urlPath": "/stingray/do/api/requirements",
    "method": "GET",
    "queryParams": [
      {
        "dataSourceId": 144,
        "requirementsContext": 1
      }
    ],
    "postParams": null,
    "type": "json"
  },
  {
    "urlPath": "/stingray/api/home/details/homeDetailsPageHeaderInfo",
    "method": "GET",
    "queryParams": [
      {
        "propertyId": 60973374
      }
    ],
    "postParams": null,
    "type": "json"
  },
  {
    "urlPath": "/stingray/api/home/details/rental-estimate",
    "method": "GET",
    "queryParams": [
      {
        "propertyId": 60973374,
        "accessLevel": 1,
        "listingId": 124921811
      }
    ],
    "postParams": null,
    "type": "json"
  },
  {
    "urlPath": "/stingray/api/region/shared-region-info",
    "method": "GET",
    "queryParams": [
      {
        "tableId": 20559,
        "regionTypeId": 2,
        "mapPageTypeId": 1
      }
    ],
    "postParams": null,
    "type": "json"
  },
  {
    "urlPath": "/stingray/api/home/details/customerConversionInfo/onMarket",
    "method": "GET",
    "queryParams": [
      {
        "propertyId": 60973374,
        "accessLevel": 1,
        "listingId": 124921811,
        "pageType": 5
      }
    ],
    "postParams": null,
    "type": "json"
  },
  {
    "urlPath": "/stingray/api/building/details-page/v1",
    "method": "GET",
    "queryParams": [
      {
        "propertyId": 60973374
      }
    ],
    "postParams": null,
    "type": "json"
  },
  {
    "urlPath": "/stingray/do/tourlist/v7/getDatePickerData",
    "method": "GET",
    "queryParams": [
      {
        "listingId": 124921811
      }
    ],
    "postParams": null,
    "type": "json"
  },
  {
    "urlPath": "/stingray/api/home/details/commute/commuteInfo",
    "method": "GET",
    "queryParams": [
      {
        "listingId": 124921811,
        "propertyId": 60973374,
        "accessLevel": 1,
        "pageType": 5
      }
    ],
    "postParams": null,
    "type": "json"
  },
  {
    "urlPath": "/stingray/api/home/details/popularityInfo",
    "method": "GET",
    "queryParams": [
      {
        "listingId": 124921811
      }
    ],
    "postParams": null,
    "type": "json"
  },
  {
    "urlPath": "/stingray/api/home/details/priceDropInfo",
    "method": "GET",
    "queryParams": [
      {
        "listingId": 124921811
      }
    ],
    "postParams": null,
    "type": "json"
  },
  {
    "urlPath": "/stingray/api/home/details/customerConversionInfo/promptEligibility",
    "method": "GET",
    "queryParams": [
      {
        "propertyId": 60973374,
        "listingId": 124921811
      }
    ],
    "postParams": null,
    "type": "json"
  },
  {
    "urlPath": "/stingray/do/qualaroo/postTour",
    "method": "GET",
    "queryParams": [],
    "postParams": null,
    "type": "json"
  },
  {
    "urlPath": "/stingray/api/home/details/mortgageCalcClaimedHomesInfo",
    "method": "GET",
    "queryParams": [],
    "postParams": null,
    "type": "json"
  },
  {
    "urlPath": "/stingray/api/home/details/avmHistoricalData",
    "method": "GET",
    "queryParams": [
      {
        "listingId": 124921811,
        "propertyId": 60973374,
        "accessLevel": 1
      }
    ],
    "postParams": null,
    "type": "json"
  },
  {
    "urlPath": "/stingray/api/home/details/flood/floodInfoLocId",
    "method": "GET",
    "queryParams": [
      {
        "locId": "US_26_163_21078221."
      }
    ],
    "postParams": null,
    "type": "json"
  }
]

Is it possible to pull the Multi-Family Financial Information from a page?

I'm attempting to pull the some financial information from a property. Do you know if this is possible?

I tried adding this to the redfin.py file but it didn't work
def u002FmainHouseInfoPanelInfo(self, property_id, listing_id, region_id, **kwargs): return self.meta_property('u002FmainHouseInfoPanelInfo', {'propertyId': property_id, 'listingId': listing_id, **kwargs})

any tips would be greatly appreciated.

Screen Shot 2021-09-10 at 11 37 09 AM

Below the fold Incorrect API Call

Not sure if this is the best way to ask, but can you point us to the unofficial redfin api documentation? Currently looking but cannot find it.

Exact address search results in multiple results

If you do a search for an exact address, "4239 60Th St San Diego, CA 92115" for example, it may return multiple results all of which start with "4239" in the same city/zip.

This may due to the nature of the autocomplete search method. Outside of iterating through the results and looking for the "best" match, is there a way to return the best match via the API call?

{ "version": 373, "errorMessage": "Success", "resultCode": 0, "payload": { "sections": [ { "rows": [ { "id": "1_5496791", "type": "1", "name": "4239 46th St", "subName": "San Diego, CA, USA", "url": "/CA/San-Diego/4239-46th-St-92115/home/5496791", "active": true, "claimedHome": false, "invalidMRS": false, "businessMarketIds": [ 112, 23, 5, 4, 3, 85, 34 ], "countryCode": "US" }, { "id": "1_5509770", "type": "1", "name": "4239 58th St", "subName": "San Diego, CA, USA", "url": "/CA/San-Diego/4239-58th-St-92115/home/5509770", "active": true, "claimedHome": false, "invalidMRS": false, "businessMarketIds": [ 112, 23, 5, 4, 3, 85, 34 ], "countryCode": "US" }, { "id": "1_5509988", "type": "1", "name": "4239 60th St", "subName": "San Diego, CA, USA", "url": "/CA/San-Diego/4239-60th-St-92115/home/5509988", "active": true, "claimedHome": false, "invalidMRS": false, "businessMarketIds": [ 112, 23, 5, 4, 3, 85, 34 ], "countryCode": "US" } ], "name": "Addresses" } ], "extraResults": {}, "responseTime": 0, "hasFakeResults": false, "isGeocoded": false, "isRedfinServiced": false } }

Owner Estimate

First of all thanks for putting this together!

I'm trying to pull the owner estimate for my home using the owner_estimate function.

When I run it, though I'm getting:

{'version': 422, 'errorMessage': 'Success', 'resultCode': 0, 'payload': {'propertyId': 11654104, 'sectionType': 2, 'isLoginVerifiedOwner': False}}

Is it possible to authenticate thru the API so that I can get a proper response?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.