Skip to main content

Python 3 的皇室战争 API 包装器

项目描述

注意 - 此项目不再维护。如果您是 pyroyale 用户,并希望接管该项目的维护,请与我联系。

火烈鸟

用于官方 Clash Royale API 的非官方 python 客户端

这个 Python 包是由OpenAPI Generator项目自动生成的:

  • API版本:1.1
  • 包版本:1.0.0
  • 构建包:org.openapitools.codegen.languages.PythonClientCodegen

要求。

Python 2.7 和 3.4+

安装和使用

点安装

如果 python 包托管在存储库中,您可以使用以下命令直接安装:

pip install git+https://github.com/GIT_USER_ID/GIT_REPO_ID.git

(您可能需要以piproot 权限运行sudo pip install git+https://github.com/GIT_USER_ID/GIT_REPO_ID.git:)

然后导入包:

import pyroyale

设置工具

通过Setuptools安装。

python setup.py install --user

(或sudo python setup.py install为所有用户安装软件包)

然后导入包:

import pyroyale

入门

请按照安装过程,然后运行以下命令:

from __future__ import print_function

import time
import pyroyale
from pyroyale.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to https://api.clashroyale.com/v1
# See configuration.py for a list of all supported configuration parameters.
configuration = pyroyale.Configuration(
    host = "https://api.clashroyale.com/v1"
)

# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

# Configure API key authorization: JWT
configuration = pyroyale.Configuration(
    host = "https://api.clashroyale.com/v1",
    api_key = {
        'authorization': 'YOUR_API_KEY'
    }
)
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['authorization'] = 'Bearer'


# Enter a context with an instance of the API client
with pyroyale.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = pyroyale.CardsApi(api_client)

    try:
        # Get list of available cards
        api_response = api_instance.get_cards()
        pprint(api_response)
    except ApiException as e:
        print("Exception when calling CardsApi->get_cards: %s\n" % e)

API 端点文档

所有 URI 都相对于https://api.clashroyale.com/v1

班级 方法 HTTP 请求 描述
卡片API 获取卡片 获取/卡片 获取可用卡片列表
氏族API get_clan 获取/clans/{clanTag} 获取部落信息
氏族API get_clan_members 获取/clans/{clanTag}/members 列出氏族成员
氏族API get_clan_river_race_log 获取/clans/{clanTag}/riverracelog 检索氏族的河流竞赛日志
氏族API get_clan_war_log 获取/clans/{clanTag}/warlog 检索氏族的氏族战争日志
氏族API get_current_river_race 获取/clans/{clanTag}/currentriverrace 检索有关氏族当前河流种族的信息
氏族API 获取当前战争 获取/clans/{clanTag}/currentwar 关于氏族当前氏族战争的信息
氏族API 搜索部落 获取/部落 搜索部落
LocationsApi get_clan_ranking 获取/locations/{locationId}/rankings/氏族 获取特定位置的氏族排名
LocationsApi get_clan_wars_ranking 获取/locations/{locationId}/rankings/clanwars 获取特定位置的部落战排名
LocationsApi 获取位置 获取/locations/{locationId} 获取位置信息
LocationsApi 获取位置 获取/位置 列出位置
LocationsApi 获得玩家排名 获取/locations/{locationId}/rankings/players 获取特定位置的玩家排名
玩家API 获取播放器 获取/players/{playerTag} 获取玩家信息
玩家API get_player_battles 获取/players/{playerTag}/battlelog 获取玩家最近的战斗日志
玩家API get_player_upcoming_chests 获取/players/{playerTag}/upcomingchests 获取有关玩家即将到来的宝箱的信息
锦标赛API get_global_tournaments 获取/globaltournaments 列出全球锦标赛
锦标赛API get_tournament 获取/锦标赛/{锦标赛标签} 获取赛事信息
锦标赛API search_tournaments 获取/锦标赛 搜索锦标赛

模型文档

授权文件

智威汤逊

  • 类型:API 密钥
  • API 密钥参数名称:授权
  • 位置:HTTP 标头

作者

开发链接

本项目使用 SonarQube 进行静态分析。分析结果在 SonarCloud。代码质量和测试覆盖率是一项正在进行的工作。

项目详情


下载文件

下载适用于您平台的文件。如果您不确定要选择哪个,请了解有关安装包的更多信息。

源分布

pyroyale-1.0.4.tar.gz (63.8 kB 查看哈希)

已上传 source

内置分布

pyroyale-1.0.4-py3-none-any.whl (166.2 kB 查看哈希)

已上传 py3