import requests
class Team:
def __init__(self, team=0):
r = requests.get(f"https://stats.foldingathome.org/api/team/{team}")
self.team = r.json()
self.donors = r.json()["donors"]
self.total_teams = self.team["total_teams"]
self.name = self.team["name"]
self.score = self.team["credit"]
self.work_units = self.team["wus"]
self.total_donors = len(self.team["donors"])
self.total_teams = self.team["total_teams"]
self.rank = self.team["rank"]
self.logo = self.team["logo"]
self.stats = self.team
@property
def highest_scorer(self):
donors = self.donors
users_and_scores = {}
scores = []
wus = []
for donor in donors:
users_and_scores[donor["name"]] = donor["credit"]
scores.append(donor["credit"])
credit = max(scores)
wus = donors[scores.index(credit)]["wus"]
rank = donors[scores.index(credit)]["rank"]
team = donors[scores.index(credit)]["team"]
id = donors[scores.index(credit)]["id"]
name = donors[scores.index(credit)]["name"]
return {
"wus": wus,
"name": name,
"rank": rank,
"credit": credit,
"team": team,
"id": id,
}
@property
def most_wus(self):
donors = self.donors
users_and_scores = {}
wus = []
for donor in donors:
users_and_scores[donor["name"]] = donor["wus"]
wus.append(donor["wus"])
work_units = max(wus)
credit = donors[wus.index(work_units)]["credit"]
rank = donors[wus.index(work_units)]["rank"]
team = donors[wus.index(work_units)]["team"]
id = donors[wus.index(work_units)]["id"]
name = donors[wus.index(work_units)]["name"]
return {
"wus": work_units,
"name": name,
"rank": rank,
"credit": credit,
"team": team,
"id": id,
}
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
共7个文件
py:5个
cfg:1个
pkg-info:1个
资源分类:Python库 所属语言:Python 资源全名:foldingathome-0.1.6.tar.gz 资源来源:官方 安装方法:https://lanzao.blog.csdn.net/article/details/101784059
资源推荐
资源详情
资源评论
收起资源包目录
foldingathome-0.1.6.tar.gz (7个子文件)
foldingathome-0.1.6
PKG-INFO 802B
setup.cfg 42B
foldingathome
__init__.py 136B
Donor.py 1KB
Team.py 2KB
Monthly.py 2KB
setup.py 934B
共 7 条
- 1
资源评论
挣扎的蓝藻
- 粉丝: 13w+
- 资源: 15万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 整卷预览.mhtml
- MySQL是一种广泛使用的开源关系型数据库管理系统,它提供了丰富的SQL语句用于数据库的创建、查询、更新和管理 以下是一些常见的
- MySQL是一种广泛使用的开源关系型数据库管理系统,它提供了丰富的SQL语句用于数据库的创建、查询、更新和管理 以下是一些常见
- MySQL是一种广泛使用的开源关系型数据库管理系统,它提供了丰富的SQL语句用于数据库的创建、查询、更新和管理 以下是一些常见的
- 基于Javascript的结婚请帖设计源码 - Invitation
- mysql语句大全及用法
- mysql语句大全及用法
- mysql语句大全及用法
- MySQL是一种广泛使用的开源关系型数据库管理系统
- MySQL是一种广泛使用的开源关系型数据库管理系统
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功