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


Python Client.get_friend_activities方法代码示例

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


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

示例1: object

# 需要导入模块: from stravalib.client import Client [as 别名]
# 或者: from stravalib.client.Client import get_friend_activities [as 别名]
#curr_segmentldr = client.get_segment_leaderboard(11493495)
#print(type(curr_segmentldr))
#print(dir(curr_segmentldr))
#will need to iterate through the curr_segmentldr object (its a collection), based on .entry_count
#print(curr_segmentldr.entry_count)
#segmentldr_json = {"segmentldr": []}
#for i in range(0, 10):
#  segmentldr_json["segmentldr"].append(json.dumps({"athlete_name": curr_segmentldr[i].athlete_name,
#    "athlete_id": curr_segmentldr[i].athlete_id,
#    "activity_id": curr_segmentldr[i].activity_id,
#    "rank": curr_segmentldr[i].rank}))

#print(segmentldr_json)

# get my friends activities
activity_feed = client.get_friend_activities()
#print(type(activity_feed))
#print(dir(activity_feed))
#print(activity_feed)
#once you get the feed, you have to call list() on it to get a dict object
activity_feed_list = list(activity_feed)
print(len(activity_feed_list))
#print(activity_feed_list[0])
#print(activity_feed_list[0].athlete)
afl_json = {"afl": []}
afl_list = []
for i in range(0, len(activity_feed_list)):
  if str(activity_feed_list[i].athlete.id) in app_friends:
    afl_json["afl"].append(json.dumps({"id": activity_feed_list[i].id}))
    afl_list.append(activity_feed_list[i].id)
开发者ID:sirmdub,项目名称:stravaNotifier,代码行数:32,代码来源:samples.py


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