当前位置: 首页>>代码示例>>Python>>正文


Python Place.get_list方法代码示例

本文整理汇总了Python中models.Place.get_list方法的典型用法代码示例。如果您正苦于以下问题:Python Place.get_list方法的具体用法?Python Place.get_list怎么用?Python Place.get_list使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在models.Place的用法示例。


在下文中一共展示了Place.get_list方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: place_list_get

# 需要导入模块: from models import Place [as 别名]
# 或者: from models.Place import get_list [as 别名]
def place_list_get(filters, user_id):
    """
    It retrieves a list of places corresponding to the specified filters.

    Parameters:
    - filters: a dictionary containing the characteristics the returned places should have.
    - user_id: if it s set, the personal data about the user added to each place (like ratings)

    Available filters:
        - 'city': 'city!province!state!country'
            The 'city' filter contains the full description of the city, with values separated with a '!'. 
            This string is split and used to retrieve only the places that are in the specified city. 
            'null' is used if part of the full city description is not available [example: 'Trento!TN!null!Italy'
            or if a bigger reagion is considered [example: 'null!TN!null!Italy' retrieves all places in the province of Trento]
        - 'lat', 'lon' and 'max_dist': lat and lon indicates the user position, while max_dist is a measure expressed in meters 
            and represnt the radius of the circular region the user is interested in. 

    Returns a tuple:
    - list of Places that satisfy the filters
    - status message
    - the http code indicating the type of error, if any
    """
    try:
        res = Place.get_list(filters, user_id)
    except (TypeError, ValueError) as e:
        return None, str(e), 400

    return res, "OK", 200
开发者ID:sphoebs,项目名称:rockshell,代码行数:30,代码来源:logic.py


注:本文中的models.Place.get_list方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。