Skip to content

Commit 780e374

Browse files
committed
version 4.0.0
1 parent 7234273 commit 780e374

File tree

3 files changed

+17
-8
lines changed

3 files changed

+17
-8
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Use the `get_new_listings` method with your username and password. This returns
1919
```python
2020
import evernetpy
2121

22-
for listing in evernetpy.get_new_listings(username, password, hours_previous=24):
22+
for listing in evernetpy.get_new_listings(username, password):
2323
print listing
2424
```
2525

@@ -115,6 +115,7 @@ logging.getLogger().setLevel(logging.INFO)
115115

116116
# Changelog
117117

118+
* 4.0.0: Breaking API change: `get_new_listings` now takes a `start_date` and `end_date` optional parameter, instead of `hours_previous`
118119
* 3.0.0: Change `get_all_active_mls_numbers` to `get_mls_numbers`. This is a breaking API change.
119120
* 2.3.0: You can now pass in date_min and date max to the `get_all_active_mls_nubmers` function
120121
* 2.2.1: Bugfix: now you can actually use the status parameter to get all active listings

evernetpy/__init__.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ def get_all_listings(username, password, property_types=[], areas=[], cities=[],
1010
return get_new_listings(
1111
username,
1212
password,
13-
hours_previous=876581,
13+
start_date = (datetime.datetime.utcnow() - datetime.timedelta(hours=876581)),
1414
property_types=property_types,
1515
areas=areas,
1616
cities=cities,
@@ -31,11 +31,13 @@ def get_mls_numbers(username, password, property_types=[], areas=[], cities=[],
3131
yield info.get('LN')
3232

3333

34-
def get_new_listings(username, password, hours_previous=24, property_types=[], areas=[], cities=[], status=[]):
35-
begin_date = (datetime.datetime.utcnow() - datetime.timedelta(hours=hours_previous)).strftime('%Y-%m-%dT%H:%M:%S')
36-
end_date = datetime.datetime.utcnow().strftime('%Y-%m-%dT%H:%M:%S')
34+
def get_new_listings(username, password, start_date=None, end_date=None, property_types=[], areas=[], cities=[], status=[]):
35+
if not start_date:
36+
start_date = (datetime.datetime.utcnow() - datetime.timedelta(hours=24)).strftime('%Y-%m-%dT%H:%M:%S')
37+
if not end_date:
38+
end_date = datetime.datetime.utcnow().strftime('%Y-%m-%dT%H:%M:%S')
3739

38-
for criteria in iterate_criteria(begin_date, end_date, property_types, areas, cities, status):
40+
for criteria in iterate_criteria(start_date, end_date, property_types, areas, cities, status):
3941
for row in execute_listing_query(username, password, 'RetrieveListingData', criteria):
4042
out = dict([(c.tag.replace('{http://www.nwmls.com/Schemas/Standard/StandardXML1_2.xsd}', ''), c.text) for c in row.getchildren()])
4143
yield look_up_all_fields(username, password, out)

tests/integration/test_property_pull.py

Lines changed: 8 additions & 2 deletions
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, get_property
1+
from evernetpy import get_new_listings, get_mls_numbers, get_photos, get_new_listings, get_property
22
from os import environ
33
import logging
44

@@ -9,6 +9,12 @@
99
logging.getLogger().addHandler(console_log)
1010
logging.getLogger().setLevel(logging.INFO)
1111

12+
def test_get_new_sold_listings():
13+
results = get_new_listings(username, password, property_types=['RESI'])
14+
for r in results:
15+
if r['ST'].upper() == 'SOLD':
16+
assert 'SP' in r
17+
1218
def test_get_new_listings_unfiltered():
1319
results = get_new_listings(username, password)
1420
assert len([r for r in results])
@@ -26,7 +32,7 @@ def test_get_new_listings_filtered_by_city():
2632
assert all([c == 'Seattle' for c in cities])
2733

2834
def test_get_all_active_mls_numbers():
29-
results = get_all_active_mls_numbers(username, password)
35+
results = get_mls_numbers(username, password)
3036
assert len([r for r in results])
3137

3238
def test_get_photos():

0 commit comments

Comments
 (0)