seme0021 / python-zillow

Python library for the Zillow API
Apache License 2.0
129 stars 64 forks source link

"Zillow did not return a valid response" #33

Open janzheng opened 5 years ago

janzheng commented 5 years ago

Hi there, I'm new to python and zillow, so bear with me

I'm getting Zillow did not return a valid response for some responses that seem to be valid.

Digging into the code, I'm finding that commenting out self.local_realestate.set_data(source_data['localRealEstate']) from place.py seems to make these responses valid.

I'm thinking it's a bug, but I'm not sure, and I don't know what "localRealEstate" means either.

SioKCronin commented 5 years ago

I got a similar response when running the example:

Traceback (most recent call last):
  File "/Users/siobhancronin/.venv/py37/lib/python3.7/site-packages/zillow/api.py", line 130, in GetDeepSearchResults
    place.set_data(xmltodict_data.get('SearchResults:searchresults', None)['response']['results']['result'])
  File "/Users/siobhancronin/.venv/py37/lib/python3.7/site-packages/zillow/place.py", line 197, in set_data
    self.zpid = source_data.get('zpid', None)
AttributeError: 'list' object has no attribute 'get'

During handling of the above exception, another exception occurred:

source_data is assumed to be type dict but is type list

YutingLu900607 commented 5 years ago

how to solve this problem? source_data is assumed to be type dict but is type list

DShep68 commented 5 years ago

someone please message back how to fix this error i'm relatively new to python as well. please give a well detailed response

stubs commented 5 years ago

I have a PR open to help to address this #37.

It seems that GetSearchResults & GetDeepSearchResults will return either a single search result or a list of search results. When the latter occurs it leads to that assumption error of data types mentioned by @YutingLu900607 and @SioKCronin.

nitrocode commented 4 years ago

Here's something I noticed was swallowed by the above error message. I cloned your branch locally and stepped through it and I see this when I look at the XML. I'm using the example code in the README.md

Example code for reference and my key is stored in env var ZWSID

import zillow
import os

key = os.environ['ZWSID']
address = "3400 Pacific Ave., Marina Del Rey, CA"
postal_code = "90292"

api = zillow.ValuationApi()
data = api.GetSearchResults(key, address, postal_code)

Swallowed error:

>>> xmltodict_data['SearchResults:searchresults']['message']['text']
'Error: this account is not authorized to execute this API call'

I can replicate this using httpie / curl. Replace $ZWSID with your key or insert it in your env variable. Run the command and you'll see the same authorization failure message.

curl https://www.zillow.com/webservice/GetSearchResults.htm\?zws-id\=$ZWSID\&address\=3400+Pacific+Ave.%2C+Marina+Del+Rey%2C+CA\&citystatezip\=90292

Noticed that I only had a few things checked on this page.

https://www.zillow.com/webservice/EditAPIProfile.htm

Once I check all of them and hit Submit, it returns a 500 error.

ERROR 500 Our Server is Unavailable Now Our engineers are working on this issue, please check back in a few minutes. Sorry about the inconvenience!

Perhaps once Zillow fixes this page, I enable all the APIs, and then this python module should work 🙏 .

For now, I may switch to Redfin.

nitrocode commented 4 years ago

Contacted Zillow and they said they are in the process of shutting down the Zillow API and have moved to an invite only API to this third party.

See: https://bridgedataoutput.com/docs/platform/