コード例 #1
0
def get_building_detail(url, campus_ids) -> Building:
    if campus_ids is None:
        campus_ids = dict()
    url = "https://dal.ca" + url
    amenities = dict()

    building_detail_soup = get_soup(url)
    campus = building_detail_soup.find("li",
                                       class_="open").find("a").get_text()
    campus_id = campus_ids.get(campus)
    if campus_id is None:
        add_campus(campus_ids, campus)
        campus_id = campus_ids.get(campus)
    sub_content = building_detail_soup.find("div", class_="subsite-content")
    name_h1 = building_detail_soup.find("h1")
    name = name_h1.get_text()
    address_p = name_h1.find_next("p")
    address = address_p.get_text()
    pointer = address_p.find_next("p")
    img = pointer.find_next("img")
    img_url = img.get("src")
    description_p = pointer.find_next("p")
    description = description_p.get_text()
    amenities_table = sub_content.find_next("h3").find_next("table")
    trs = amenities_table.find_all("tr")
    for tr in trs:
        key = tr.find("th").get_text().strip()
        value = tr.find("td").get_text().strip()
        if key == "Accessibilty":
            key = "Accessibility"
        amenities[key] = value

    return Building(name, address, description, img_url, amenities, campus_id)
コード例 #2
0
def create():
    schema = BuildingSchema()

    try:
        data = schema.load(request.get_json())
        building = Building(**data, user=g.current_user)
        db.commit()
    except ValidationError as err:
        return jsonify({
            'message': 'Validation failed',
            'errors': err.messages
        }), 422
    return schema.dumps(building), 201
コード例 #3
0
    art_nouveau = Style(name='Art Nouveau')
    classical = Style(name='Classical')
    early_georgian = Style(name='Early Georgian')
    gothic = Style(name='Gothic')
    neo_futurism = Style(name='Neo Futurism')

    Building(
        name='The Lloyd\'s Building',
        architect='Sir Richard Rogers',
        style=radical_bowellism,
        # (refers to designs that see the services for the building located on the exterior to maximise the space inside)
        address='1 Lime Street, London',
        latitude=51.51301,
        longitude=-0.08228,
        postcode='EC3M 7HA',
        construction=rcf,
        built=1978,
        about=
        'Lloyds of London is the world’s greatest insurance market. It had moved its dealing room twice in 50 years and wanted a building that would provide for its needs well into the 21st century. It was also imperative that Lloyd’s could continue their operations unhindered during the rebuilding operation, which almost inevitably involved the demolition of the existing 1928 building. The competition for a new building was won on the basis not of an architectural proposal but of a strategy for the future of this key City institution. Richard Rogers Partnership (RRP) proposed a building where the dealing room could expand or contract, according to the needs of the market, by means of a series of galleries around a central space. To maximise space, services are banished to the perimeter. As the architectural form of the building evolved, particular attention was paid to its impact on the surrounding area, especially on the listed 19th century Leadenhall Market. As a result, Lloyd’s became a complex grouping of towers, almost Gothic in feeling – an effect enhanced by the height of the external plant-room towers. Lloyd’s is one of the great architectural achievements of the 1980s, one of the buildings which confirmed the practice’s position in the front rank of international architects. It has emerged as one of the greatest modern British buildings, one which balances technical efficiency with architectural expressiveness to produce an effect which might be called highly romantic and judged a very positive addition to the London skyline. The building was Grade I listed in 2011, the youngest structure to obtain this status. English Heritage described it as “universally recognized as one of the key buildings of the modern epoch.',
        images=[
            'https://tokyofox.files.wordpress.com/2015/01/dscn0270.jpg',
            'http://spinlister-blog.s3.amazonaws.com/2016/04/Modern-Architecture-London-2.jpg',
            'http://www.bbc.co.uk/staticarchive/e8eea2b72d54aa09dfb5cfb4bf882e7c78059ed7.jpg',
            'https://i.pinimg.com/564x/30/fa/87/30fa87305c142afbe0b9e5fe372cc672.jpg'
        ],
        user=char)

    Building(
        name='The British Museum',
        architect='Sir Robert Smirke',
        style=greek_revival,
        # (refers to designs that see the services for the building located on the exterior to maximise the space inside)