Skip to content

Commit c12934b

Browse files
committed
Add ability to look up a single mls number
1 parent b84b38e commit c12934b

File tree

4 files changed

+30
-2
lines changed

4 files changed

+30
-2
lines changed

README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,16 @@ evernetpy.get_all_active_mls_numbers(username, password)
6767

6868
This gives you an iterator with all the active MLS numbers in it.
6969

70+
## Get a single property by mls_number
71+
72+
```python
73+
import evernetpy
74+
75+
evernetpy.get_property(username, password, mls_number)
76+
```
77+
78+
Returns a dictionary with the information from a single MLS number. Looks up all the data for the lookup fields for you behind the scenes.
79+
7080
## Get Photos
7181

7282
Call this with the listing ID and you get an iterator with photos in it. Each photo is a dictionary with some metadata about the photo. The BLOB key has the binary of the actual photo.
@@ -96,6 +106,7 @@ logging.getLogger().setLevel(logging.INFO)
96106

97107
# Changelog
98108

109+
* 2.1.0: Add the ability to grab a single listing by MLS number
99110
* 2.0.3: It turns out that Evernet assumes you only want 'RESI' properties if you don't explicitly specify, so let's do so.
100111
* 2.0.2: Fixed a bug where items were not being filtered on in the `get_all_active_listings` method
101112
* 2.0.1: Fixed a bug where status wasn't being filtered correctly

evernetpy/__init__.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,14 @@ def get_photos(username, password, listing_id):
3939
out = dict([(c.tag.replace('{NWMLS:EverNet:ImageData:1.0}', ''), c.text) for c in row.getchildren()])
4040
out['BLOB'] = base64.b64decode(out['BLOB'])
4141
yield out
42+
43+
def get_property(username, password, mls_number):
44+
criteria = {
45+
'MLS':'nwmls',
46+
'ListingNumber':mls_number
47+
}
48+
results = execute_listing_query(username, password, 'RetrieveListingData', criteria)
49+
first_result = next(results) # only return first match
50+
out = dict([(c.tag.replace('{http://www.nwmls.com/Schemas/Standard/StandardXML1_2.xsd}', ''), c.text) for c in first_result.getchildren()])
51+
return look_up_all_fields(username, password, out)
52+

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ def run_tests(self):
1919
sys.exit(errno)
2020

2121
setup(name='evernetpy',
22-
version='2.0.3',
22+
version='2.1.0',
2323
description="A Python library for interacting with the EverNet listing service",
2424
author='Kevin McCarthy',
2525
author_email='[email protected]',

tests/integration/test_property_pull.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from evernetpy import get_new_listings, get_all_active_mls_numbers, get_photos, get_new_listings
1+
from evernetpy import get_new_listings, get_all_active_mls_numbers, get_photos, get_new_listings, get_property
22
from os import environ
33
import logging
44

@@ -32,3 +32,9 @@ def test_get_all_active_mls_numbers():
3232
def test_get_photos():
3333
results = get_photos(username, password, 81796)
3434
assert len([r for r in results])
35+
36+
def test_get_property():
37+
property = get_property(username, password, '611638')
38+
# note: this must be an active mls number, if this test stats failing,
39+
# try changing it :)
40+
assert property

0 commit comments

Comments
 (0)