VTES卡和TWDA的Web API
项目描述
KRCG API
基于VEKN 官方卡片文本 和 锦标赛获胜套牌存档 (TWDA) 的V:tES基于的Web API。
部分材料是Paradox Interactive AB的版权和商标,并已获得许可使用。版权所有。更多信息请访问 white-wolf.com。
在线API和文档
KRCG是一个免费使用(并有文档)的 在线API。任何人都可以免费使用它,无需保证。
重大版本升级后,将在适当的弃用期间引入破坏性更改。
贡献
欢迎贡献!
此API是KRCG Python库的衍生品,请参阅KRCG仓库,以了解问题、讨论和贡献指南。
示例
通过名称或ID查询卡片,获取文本、裁决和图片URL
curl -X GET "http://127.0.0.1:8000/card/Alastor" -H "accept: application/json"
{
"_name": "Alastor",
"_set": "Gehenna:R, KMW:PAl, KoT:R",
"artists": [
"Monte Moore"
],
"card_text": "Requires a justicar or Inner Circle member...",
"id": 100038,
"name": "Alastor",
"ordered_sets": [
"Gehenna",
"Kindred Most Wanted",
"Keepers of Tradition"
],
"printed_name": "Alastor",
"rulings": {
"links": {
"[ANK 20200901]": "http://www.vekn.net/forum/rules-questions/78830-alastor-and-ankara-citadel#100653",
"[LSJ 20040518-2]": "https://groups.google.com/g/rec.games.trading-cards.jyhad/c/4emymfUPwAM/m/JF_o7OOoCbkJ",
"[LSJ 20040518]": "https://groups.google.com/d/msg/rec.games.trading-cards.jyhad/4emymfUPwAM/B2SCC7L6kuMJ"
},
"text": [
"If the weapon retrieved costs blood, that cost is paid by the vampire chosen by the vote. [LSJ 20040518]",
"Requirements do not apply. If a discipline is required (eg. {Inscription}) and the Alastor vampire does not have it, the inferior version is used. [ANK 20200901] [LSJ 20040518-2]"
]
},
"scans": {
"Gehenna": "https://static.krcg.org/card/set/gehenna/alastor.jpg",
"Keepers of Tradition": "https://static.krcg.org/card/set/keepers-of-tradition/alastor.jpg",
"Kindred Most Wanted": "https://static.krcg.org/card/set/kindred-most-wanted/alastor.jpg"
},
"sets": {
"Gehenna": [{ "rarity": "Rare", "release_date": "2004-05-17"}],
"Keepers of Tradition": [{ "rarity": "Rare", "release_date": "2008-11-19"}],
"Kindred Most Wanted": [
{
"copies": 1,
"precon": "Alastors",
"release_date": "2005-02-21"
}
]
},
"types": ["Political Action"],
"url": "https://static.krcg.org/card/alastor.jpg"
}
通过文本、类型、学科、标题、城市、艺术家、系列、预制起始卡组、小组、容量、特质、宗派、奖励值等进行卡片搜索。
curl
-X POST "http://127.0.0.1:8000/card_search"
-H "Content-Type: application/json"
-d "{\"type\":[\"political action\"],\"sect\":[\"anarch\"]}"
[
"Anarch Salon",
"Eat the Rich",
"Firebrand",
"Free States Rant",
"Patsy",
"Reckless Agitation",
"Revolutionary Council",
"Sweeper"
]
从
curl
-X POST "http://127.0.0.1:8000/candidates"
-H "Content-Type: application/json"
-d "{\"cards\":[\"Cybele\",\"Nana Buruku\"]}"
[
{
"average": 14,
"card": "Ashur Tablets",
"deviation": 6.25,
"score": 1
},
{
"average": 1,
"card": "Giant's Blood",
"deviation": 0,
"score": 1
},
{
"average": 2,
"card": "The Parthenon",
"deviation": 0.81,
"score": 1
},
{
"average": 1,
"card": "Archon Investigation",
"deviation": 0,
"score": 0.9
},
...
]
以及其他一些功能,包括
- 在TWDA中按卡片、日期、作者和玩家数量搜索卡组
- 卡组列表格式转换
- 从阿玛兰斯共享URL检索卡组列表
- 卡片名称补全
请查阅在线文档获取更多信息。
托管Web API
要托管Web API,您可以使用pip进行安装
pip install "krcg-api"
默认情况下未安装wsgi服务器,您需要安装一个。然后可以轻松配置HTTP Web服务器来服务WSGI应用程序,请查看您的Web服务器文档。
API可以使用uWSGI提供
uwsgi --module krcg_api.wsgi:application
gunicorn krcg_api.wsgi:application
预期两个环境变量:GITHUB_USERNAME
和GITHUB_TOKEN
,以允许API作为用户连接到GitHub,以便在仓库中作为问题发布新裁决(/submit-ruling
端点)。
请参阅GitHub帮助,了解如何为您想使用的账户生成个人令牌。
开发
KRCG的开发版本会安装uWSGI来提供服务,这是目前首选的WSGI服务器。
$ pip install -e ".[dev]"
$ make serve
...
uwsgi socket 0 bound to TCP address 127.0.0.1:8000
您可以通过在提供的地址上使用浏览器来检查API是否运行:http://127.0.0.1:8000。
环境变量GITHUB_USERNAME
和GITHUB_TOKEN
可以通过krcg文件夹根目录下的个人.env
文件提供(被git忽略)
export GITHUB_USERNAME="dedicated_github_username_for_the_api"
export GITHUB_TOKEN="the_matching_github_token"
项目详情
下载文件
下载适用于您平台的文件。如果您不确定选择哪个,请了解有关安装包的更多信息。
源分发
构建分发
krcg_api-3.1.tar.gz的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | 84c3068ae043019fa2b36b5627ef0ee61793a00e603ea4ea5bb03110663a344d |
|
MD5 | 8408819a602b1fc18c7b2f2978e5c5c0 |
|
BLAKE2b-256 | 2f213a06aac741cff1163a8c023d9f1b68771676415415aa2fef2bf6eecdaf6f |
krcg_api-3.1-py3-none-any.whl 的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | 2d19747dd5d2f18c36d0cdf5beab321b31bec488fecf4e00b26c653f6c4b60c7 |
|
MD5 | 05d26d2ce6be74824919be65d72d064b |
|
BLAKE2b-256 | 0e1f422fb17312ef6a15c9d778d9cf4baed8b1e42fff3645604817e3d4c6f892 |