echo vr的http api的python绑定。
echovr-api的Python项目详细描述
回声虚拟现实API
echo vr的http api的python绑定。
安装
如果你还没有,install Python 3和Pipenv。
现在,在项目目录中,运行:
pipenv install echovr-api
用法
基本用法示例:
from requests.exceptions import ConnectionError
import json
import echovr_api
try:
game_state = echovr_api.fetch_state()
print(f"Game status: {game_state.game_status}")
print(f"Seconds on clock: {game_state.game_clock}")
if (game_state.blue_team.score > game_state.orange_team.score):
print("Blue team is winning!")
elif (game_state.orange_team.score > game_state.blue_team.score):
print("Orange team is winning!")
else:
print("It's tied!")
print(f"Score: {game_state.blue_team.score} - {game_state.orange_team.score}")
except ConnectionError as e:
print("Connection refused. Make sure you're running Echo VR with the -http option and that you're in a match.")
except json.decoder.JSONDecodeError as e:
print("Could not decode response. (Not valid JSON.)")
有关可用方法和类的全面文档,请参见full API Documentation on Read The Docs。
贡献
要获取开始对此包进行更改所需的所有信息,请首先install Python 3和Pipenv,克隆此存储库,然后运行:
pipenv install
试试看
要使用api,请使用-http标志打开echo vr的一个实例,然后运行:
pipenv run python -i ./test.py
释放过程
首先,更新CHANGELOG.md
和setup.py
和docs/source/conf.py
中的版本号。然后提交、标记并推送这些更改。
接下来,构建包:
pipenv install --dev
pipenv run python setup.py sdist bdist_wheel
最后,将构建的包上传到pypi。你可以用twine
来完成这项工作。
(pip install twine
):
twine upload dist/*