redfin icon indicating copy to clipboard operation
redfin copied to clipboard

The API now throws a 403 Client error

Open dreed47 opened this issue 1 year ago • 5 comments

This stopped working at least 2 weeks ago. Running the code examples now returns a 403 Forbidden error. Whats odd is that if you just copy the url into a browser it returns a 200 with good data.

File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/redfin/redfin.py", line 15, in meta_property return self.meta_request('api/home/details/' + url, { ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/redfin/redfin.py", line 23, in meta_request response.raise_for_status() File "/Users/david/Library/Python/3.11/lib/python/site-packages/requests/models.py", line 1024, in raise_for_status raise HTTPError(http_error_msg, response=self) requests.exceptions.HTTPError: 403 Client Error: Forbidden for url: https://redfin.com/stingray/api/home/details/mainHouseInfoPanelInfo?accessLevel=1&propertyId=43790344&listingId=

dreed47 avatar Dec 12 '24 14:12 dreed47

It looks like Redfin is expecting a valid user-agent string and not just 'redfin', When I change it to 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36' The call works

dreed47 avatar Dec 12 '24 22:12 dreed47

@dreed47 would the change be done just in redfin.py?

class Redfin:
    def __init__(self):
        self.base = 'https://redfin.com/stingray/'
        self.user_agent_header = {
            'user-agent': 'redfin'
        }

ianvanhoven avatar Jan 02 '25 17:01 ianvanhoven

these changes aren't working

tahiraslammm avatar Jan 08 '25 14:01 tahiraslammm

I've been unable to get this to work consistently. Most likely Redfin as attempting to block external API traffic. I would recommend moving away from this integration unless/until Redfin publishes an official API.

dreed47 avatar Jan 08 '25 15:01 dreed47

When I curl the underlying property URLs i get a rate-limiting error saying “we think you’re a robot” … so I think you’re right :|

On Wed, Jan 8, 2025 at 7:59 AM dreed47 @.***> wrote:

I've been unable to get this to work consistently. Most likely Redfin as attempting to block external API traffic. I would recommend moving away from this integration unless/until Redfin publishes an official API.

— Reply to this email directly, view it on GitHub https://github.com/reteps/redfin/issues/19#issuecomment-2578033676, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEWS5DQHIB27TZD5JEMIMFT2JVDMTAVCNFSM6AAAAABTP33352VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDKNZYGAZTGNRXGY . You are receiving this because you commented.Message ID: @.***>

ianvanhoven avatar Jan 08 '25 16:01 ianvanhoven