forked from reteps/redfin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.py
64 lines (56 loc) · 1.38 KB
/
test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
from redfin import Redfin
import json
ADDRESS = '4544 Radnor St, Detroit Michigan'
engine = Redfin()
response = engine.search(ADDRESS)
url = response['payload']['exactMatch']['url']
data = engine.initial_info(url)['payload']
property_id = data['propertyId']
listing_id = data['listingId']
URL_REQUESTS = [
engine.page_tags,
engine.primary_region
]
PROPERTY_ID_REQUESTS = [
engine.hood_photos,
engine.more_resources,
engine.page_header,
engine.property_comments,
engine.building_details_page,
engine.owner_estimate,
engine.claimed_home_seller_data,
engine.cost_of_home_ownership
]
LISTING_ID_REQUESTS = [
engine.floor_plans,
engine.tour_list_date_picker
]
PROPERTY_REQUESTS = [
engine.similar_listings,
engine.similar_sold,
engine.nearby_homes,
engine.above_the_fold,
engine.below_the_fold,
engine.property_parcel,
engine.activity,
engine.customer_conversion_info_off_market,
engine.rental_estimate,
engine.avm_historical,
engine.info_panel,
engine.descriptive_paragraph,
engine.avm_details,
engine.tour_insights,
]
# TODO test these resources
OTHER_REQUESTS = [
engine.stats,
engine.shared_region
]
def test_request_group(fns, *args):
for fn in fns:
fn(*args)
test_request_group(URL_REQUESTS, url)
test_request_group(PROPERTY_ID_REQUESTS, property_id)
test_request_group(LISTING_ID_REQUESTS, listing_id)
test_request_group(PROPERTY_REQUESTS, property_id, listing_id)
print('Tests passed.')