/python-listhub-api-snippet

An implementation of a ListHub RESO compatible http client.

Primary LanguagePythonMIT LicenseMIT

listhub

This is a reference implementation. It was originally a prototype designed to query the API and generate customized landing pages for listings that meet the specified criteria.

Connecting to ListHub's API with Python

ListHub provides a RESO Web API compliant service. The API uses OAuth 2.0 for authentication.

Usage

The initialized client will automatically fetch and manage access tokens transparently in the background.

from api import ListHubClient

# create expects LISTHUB_CLIENT_ID and
# LISTHUB_CLIENT_SECRET defined as environment
# variables.

client = ListHubClient.create()

# The API will return a JSON response with an array of
# listing JSON objects. See adapters.py to simplify
# working with the ListHub's json response objects.
listings = client.get_listings()

see api.py for more details.

N.B.:

  1. Rate-limiting should be handled by the consuming code.
  2. The listing query is hard-coded to properties valued over 1 million.