def get_current(post_code): api = zoopla.api(version=1, api_key='h8w8e3vza6wprx4qeeyvhdd3', cache_seconds=0) ret = list() listings = api.property_listings(area=post_code, max_results=None, listing_status='sale') for listing in listings: es_entry = entry_utils.fill_esentry_zoopla(listing) es_entry['fetch_query'] = post_code entry_utils.update_esentry_geo(es_entry) ret.append(es_entry) return ret
def append_rental_information(name, lat, lon, file_name): api = zoopla.api(version=1, api_key=API_KEY) request_interval = 3600/RATE_LIMIT + 1 try: listings = list(api.property_listings(latitude=lat, longitude=lon, **SEARCH_OPTIONS)) current_store = cPickle.load(open(file_name, 'r')) current_store[name] = listings cPickle.dump(current_store, open(file_name, 'w+')) print('Fetched {}, found {} listings'.format(name, len(listings))) time.sleep(request_interval) except Exception as e: print 'Failed with error {} on name {} and coords {}'.format(e, name, (lat, lon))
import tornado.web import json import zoopla import urllib.parse import math import polyline import requests trovit_client_id = 'CLIENT_ID' zoopla_key = 'API_KEY' proxies = {} use_proxy = False if use_proxy: proxies['http'] = 'http://127.0.0.1:8989' api = zoopla.api(version=1, api_key=zoopla_key) def list_properties_nestoria(latitude, longitude, radius, min_bedrooms, min_bathrooms, min_price=0, max_price=0): (lat_min, lon_min, lat_max, lon_max) = boundingBox(latitude, longitude, radius) payload = { 'action': 'search_listings', 'encoding': 'json', 'south_west': '%f,%f' % (lat_min, lon_min),
def get_api(): key = json.load(open('resources/zoopla_key.json', 'r')) return zoopla.api(version=1, api_key=key, cache_seconds=CACHE_LENGTH)
import zoopla import pandas as pd api = zoopla.api(version=1, api_key='gh2q9a6bkwk6req537gngfe5') CSV_FILE = 'test.csv' def read_postcodes(CSV_FILE): df = pd.read_csv(CSV_FILE) return df def write_to_file(): pass data = read_postcodes(CSV_FILE) house_price_list = [] for pc in data['postcode']: print pc out = api.average_sold_prices(postcode=pc, output_type='outcode', area_type='postcodes') average_sold_price_list = [] for item in out['areas']: # building in some redundancy by having the 3 year price as well item_price_1year = int(item['average_sold_price_1year']) item_price_3year = int(item['average_sold_price_3year']) if item_price_1year != 0: average_sold_price_list.append(item_price_1year) if item_price_3year != 0: average_sold_price_list.append(item_price_3year) if len(average_sold_price_list) == 0: