本文整理汇总了Python中users.User.add_event方法的典型用法代码示例。如果您正苦于以下问题:Python User.add_event方法的具体用法?Python User.add_event怎么用?Python User.add_event使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类users.User
的用法示例。
在下文中一共展示了User.add_event方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_next_best_stations
# 需要导入模块: from users import User [as 别名]
# 或者: from users.User import add_event [as 别名]
def get_next_best_stations(phone_number):
user = User(phone_number)
stations = station_api.get_best_station(user.station_lat, user.station_lon)
user.add_event("get_next_best_station")
user.add_event("get_next_best_station_result", stations['second']['bike']['location_name'])
return stations['second']
示例2: get_closest_station
# 需要导入模块: from users import User [as 别名]
# 或者: from users.User import add_event [as 别名]
def get_closest_station (phone_number, addr):
#hack 1, add Toronto at the end (Should probably be doing this in the geocode api instead sohow
#hack 2, Weird results if Yonge doesn't have a street at the end, Yonge and Bloor doesn't resolve correctly
address = addr.replace("Toronto", "").replace("toronto", "").replace("yonge", "yonge st").replace("Yonge", "Yonge St")
user = User(phone_number)
coordinates = geo_api.convert_address_to_geo(address)
#Latitude Longitude
station = station_api.get_best_station(coordinates['Latitude'], coordinates['Longitude'])
if (station['first']['distance'] < 5):
user.add_stations(address, station['first']['location_name'], coordinates['Latitude'], coordinates['Longitude'])
user.add_event("search", address)
user.add_event("search_result", station['first']['location_name'])
return station['first']
else:
return None