Exemplo n.º 1
0
def get_new_listings(username, password, hours_previous=24, property_types=[], areas=[], cities=[], status=[]):
    begin_date = (datetime.datetime.utcnow() - datetime.timedelta(hours=hours_previous)).strftime('%Y-%m-%dT%H:%M:%S')
    end_date = datetime.datetime.utcnow().strftime('%Y-%m-%dT%H:%M:%S')

    for criteria in iterate_criteria(begin_date, end_date, property_types, areas, cities, status):
        for row in execute_listing_query(username, password, 'RetrieveListingData', criteria):
            out = dict([(c.tag.replace('{http://www.nwmls.com/Schemas/Standard/StandardXML1_2.xsd}', ''), c.text) for c in row.getchildren()])
            yield look_up_all_fields(username, password, out)
Exemplo n.º 2
0
def get_property(username, password, mls_number):
    criteria = {
        'MLS':'nwmls',
        'ListingNumber':mls_number
    }
    results = execute_listing_query(username, password, 'RetrieveListingData', criteria)
    first_result = next(results) # only return first match
    out = dict([(c.tag.replace('{http://www.nwmls.com/Schemas/Standard/StandardXML1_2.xsd}', ''), c.text) for c in first_result.getchildren()])
    return look_up_all_fields(username, password, out)
Exemplo n.º 3
0
def get_property(username, password, mls_number):
    criteria = {'MLS': 'nwmls', 'ListingNumber': mls_number}
    results = execute_listing_query(username, password, 'RetrieveListingData',
                                    criteria)
    first_result = next(results)  # only return first match
    out = dict([(c.tag.replace(
        '{http://www.nwmls.com/Schemas/Standard/StandardXML1_2.xsd}',
        ''), c.text) for c in first_result.getchildren()])
    return look_up_all_fields(username, password, out)
Exemplo n.º 4
0
def get_mls_numbers(username, password, property_types=[], areas=[], cities=[], status=['A'], date_min=None, date_max=None):
    if not date_min:
        date_min = datetime.datetime(year=1990, month=1, day=1, hour=0, minute=0, second=0)
    if not date_max:
        date_max = datetime.datetime(year=3000, month=1, day=1, hour=0, minute=0, second=0)
    date_min = date_min.strftime('%Y-%m-%dT%H:%M:%S')
    date_max = date_max.strftime('%Y-%m-%dT%H:%M:%S')
    for criteria in iterate_criteria(date_min, date_max, status=status, property_types=property_types, areas=areas, cities=cities):
        for row in execute_listing_query(username, password, 'RetrieveListingData', criteria, filter="LN,ST"):
            info = dict([(c.tag.replace('{http://www.nwmls.com/Schemas/Standard/StandardXML1_2.xsd}', ''), c.text) for c in row.getchildren()])
            yield info.get('LN')
Exemplo n.º 5
0
def get_new_listings(username, password, start_date=None, end_date=None, property_types=[], areas=[], cities=[], status=[]):
    if not start_date:
        start_date = datetime.datetime.utcnow() - datetime.timedelta(hours=24)
    if not end_date:
        end_date = datetime.datetime.utcnow()

    start_date = start_date.strftime(TIME_FORMAT_STRING)
    end_date = end_date.strftime(TIME_FORMAT_STRING)
    for criteria in iterate_criteria(start_date, end_date, property_types, areas, cities, status):
        for row in execute_listing_query(username, password, 'RetrieveListingData', criteria):
            out = dict([(c.tag.replace('{http://www.nwmls.com/Schemas/Standard/StandardXML1_2.xsd}', ''), c.text) for c in row.getchildren()])
            yield look_up_all_fields(username, password, out)
Exemplo n.º 6
0
def _get_amenities(username, password, prop_type):
    for r in execute_listing_query(username, password, 'RetrieveAmenityData', {
            'MLS': 'nwmls',
            'PropertyType': prop_type
    }):
        field_name = r.find(
            '{http://www.nwmls.com/Schemas/General/EverNetAmenityXML.xsd}Code'
        ).text
        values = r.find(
            '{http://www.nwmls.com/Schemas/General/EverNetAmenityXML.xsd}Values'
        ).getchildren()
        row = dict([(c.tag.replace(
            '{http://www.nwmls.com/Schemas/General/EverNetAmenityXML.xsd}',
            ''), c.text) for c in values])
        yield field_name, row
Exemplo n.º 7
0
def get_mls_numbers(username,
                    password,
                    property_types=[],
                    areas=[],
                    cities=[],
                    status=['A'],
                    date_min=None,
                    date_max=None):
    if not date_min:
        date_min = datetime.datetime(year=1990,
                                     month=1,
                                     day=1,
                                     hour=0,
                                     minute=0,
                                     second=0)
    if not date_max:
        date_max = datetime.datetime(year=3000,
                                     month=1,
                                     day=1,
                                     hour=0,
                                     minute=0,
                                     second=0)
    date_min = date_min.strftime(TIME_FORMAT_STRING)
    date_max = date_max.strftime(TIME_FORMAT_STRING)
    for criteria in iterate_criteria(date_min,
                                     date_max,
                                     status=status,
                                     property_types=property_types,
                                     areas=areas,
                                     cities=cities):
        for row in execute_listing_query(username,
                                         password,
                                         'RetrieveListingData',
                                         criteria,
                                         filter="LN,ST"):
            info = dict([(c.tag.replace(
                '{http://www.nwmls.com/Schemas/Standard/StandardXML1_2.xsd}',
                ''), c.text) for c in row.getchildren()])
            yield info.get('LN')
Exemplo n.º 8
0
def get_new_listings(username,
                     password,
                     start_date=None,
                     end_date=None,
                     property_types=[],
                     areas=[],
                     cities=[],
                     status=[]):
    if not start_date:
        start_date = datetime.datetime.utcnow() - datetime.timedelta(hours=24)
    if not end_date:
        end_date = datetime.datetime.utcnow()

    start_date = start_date.strftime(TIME_FORMAT_STRING)
    end_date = end_date.strftime(TIME_FORMAT_STRING)
    for criteria in iterate_criteria(start_date, end_date, property_types,
                                     areas, cities, status):
        for row in execute_listing_query(username, password,
                                         'RetrieveListingData', criteria):
            out = dict([(c.tag.replace(
                '{http://www.nwmls.com/Schemas/Standard/StandardXML1_2.xsd}',
                ''), c.text) for c in row.getchildren()])
            yield look_up_all_fields(username, password, out)
Exemplo n.º 9
0
def _get_amenities(username, password, prop_type):
    for r in execute_listing_query(username, password, 'RetrieveAmenityData', {'MLS': 'nwmls', 'PropertyType': prop_type}):
        field_name = r.find('{http://www.nwmls.com/Schemas/General/EverNetAmenityXML.xsd}Code').text
        values = r.find('{http://www.nwmls.com/Schemas/General/EverNetAmenityXML.xsd}Values').getchildren()
        row = dict([(c.tag.replace('{http://www.nwmls.com/Schemas/General/EverNetAmenityXML.xsd}', ''), c.text) for c in values])
        yield field_name, row
Exemplo n.º 10
0
def _get_offices(username, password):
    for row in execute_listing_query(username, password, 'RetrieveOfficeData', {'MLS': 'nwmls'}):
        yield dict([(c.tag.replace('{http://www.nwmls.com/Schemas/Standard/StandardXML1_1.xsd}', ''), c.text) for c in row.getchildren()])
Exemplo n.º 11
0
def _get_offices(username, password):
    for row in execute_listing_query(username, password, 'RetrieveOfficeData',
                                     {'MLS': 'nwmls'}):
        yield dict([(c.tag.replace(
            '{http://www.nwmls.com/Schemas/Standard/StandardXML1_1.xsd}',
            ''), c.text) for c in row.getchildren()])