蟒蛇实现蓝色联盟
pyTBA的Python项目详细描述
#pytba
python 3 Blue Alliance API层,用于解析第一个机器人竞赛事件数据。
https://www.thebluealliance.com/
代码:
使用“pip”安装:
``bash
pip install pytba
````
“
``
基本用法:
最基本的用法是查询tba api中的任意url。
此操作由:
``python
tba.tba get('relative/url/goes/here')
````
pytba向tba api发出请求(https://www.thebluealliance.com/api/v2/)
并返回存储为‘dict’的响应。(请参见[TBA API文档](https://www.thebluealliance.com/api docs)了解有关键的更多信息)
``python
tba.event\u get('<;event code>;')
````
这将返回一个“event”对象,该对象将位置、团队、匹配、奖励和排名数据组合在一起。
从“event”中检索“match”模型的列表:
``python
event=tba.event嫒get('2016chcmp')
matches=event.matches
````
>可以在源代码的文档中找到更高级的用法。
计算
核心api代码现在位于“pytba.api”模块中。“event”类现在位于“pytba.models”下。decorators和utility方法现在位于“pytba.util”下,opr calculation现在位于“pytba.stat”下。如果需要克隆旧代码,请查看[初始版本](https://github.com/thing342/pytba/releases/tag/init)。
python 3 Blue Alliance API层,用于解析第一个机器人竞赛事件数据。
https://www.thebluealliance.com/
代码:
使用“pip”安装:
``bash
pip install pytba
````
“
``
基本用法:
最基本的用法是查询tba api中的任意url。
此操作由:
``python
tba.tba get('relative/url/goes/here')
````
pytba向tba api发出请求(https://www.thebluealliance.com/api/v2/)
并返回存储为‘dict’的响应。(请参见[TBA API文档](https://www.thebluealliance.com/api docs)了解有关键的更多信息)
tba.event\u get('<;event code>;')
````
这将返回一个“event”对象,该对象将位置、团队、匹配、奖励和排名数据组合在一起。
从“event”中检索“match”模型的列表:
``python
event=tba.event嫒get('2016chcmp')
matches=event.matches
````
>可以在源代码的文档中找到更高级的用法。
计算
核心api代码现在位于“pytba.api”模块中。“event”类现在位于“pytba.models”下。decorators和utility方法现在位于“pytba.util”下,opr calculation现在位于“pytba.stat”下。如果需要克隆旧代码,请查看[初始版本](https://github.com/thing342/pytba/releases/tag/init)。