http://fortnitetracker.com/api的python包装器

fortnite-python的Python项目详细描述


Build StatusPyPI versionRequirements Status

金丝蟒

用于http://fortnitetracker.com/api的python包装器。

安装

你可以通过pip安装它

pip install fortnite-python

用法

您需要在https://fortnitetracker.com/site-api注册api密钥

那就很简单了:

from fortnite_python import Fortnite

fortnite = Fortnite('Given api key')

检索播放器:

>>> from fortnite_python import Fortnite

>>> fortnite = Fortnite('Given api key')
>>> player = fortnite.player('playername')
player

<Player 20a8fafaa-6chfj-6455-b715-2424fff pc>

默认平台是PC,如果你想使用不同的平台,你应该 这样做:

>>> from fortnite_python import Fortnite
>>> from fortnite_python.domain import Platform

>>> fortnite = Fortnite('Given api key')
>>> player = fortnite.player('playername', Platform.XBOX)
>>> player
<Player 20a8fafaa-6chfj-6455-b715-2424fff xb1>

您可以查看可用的平台here

检索玩家状态:

>>> from fortnite_python import Fortnite
>>> from fortnite_python.domain import Mode

>>> fortnite = Fortnite('Given api key')
>>> player = fortnite.player('playername')
>>> stats = player.get_stats(Mode.DUO)
>>> stats.wins
'10'
>>> stats.top3
'20'

您可以检查可用的模式here

获取匹配数据:

调用匹配项时,必须传递玩家id和匹配项的数量 您需要(从1到50)

>>> player = fortnite.player('playername')
<Player 20a8fafaa-6chfj-6455-b715-2424fff pc>

>>> fortnite.matches(player.id, 5)
[<Match 806686859>, <Match 806611889>, <Match 806602331>, <Match 806532871>,
    <Match 806522998>]

检索当前挑战:

>>> from fortnite_python import Fortnite

>>> fortnite = Fortnite('Given api key')
>>> challenges = fortnite.challenges()
>>> print (challenges)
[<Challenge 1>, <Challenge 1>, <Challenge 1>, <Challenge 1>, <Challenge 1>, <Challenge 1>, <Challenge 1>]
>>> challenges[0].name
Visit all of the Corrupted Areas
>>> challenges[0].reward_picture_url
https://cdn.thetrackernetwork.com/cdn/trackernetwork/63D2upload.png

检索当前的Fortnite存储:

>>> from fortnite_python import Fortnite

>>> fortnite = Fortnite('Given api key')
>>> store = fortnite.store()
>>> fortnite.store()
[<StoreItem 1974>, <StoreItem 6010>, <StoreItem 1246>, <StoreItem 6012>,
<StoreItem 918>, <StoreItem 4835>, <StoreItem 6050>, <StoreItem 5981>]

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java以编程方式最小化JInternalFrame?   java使用JsonPath将不均匀列表提取为类型化对象   spring如何将java/resources文件获取到InputStream?   Java逻辑错误并不总是存在   java Firebase,更新特定字段   Java stream groupby并同时加入以进行csv导出   java安卓:如果出现任何声音,监听器将录制声音   java如何从多个文件中轮询最后修改的文件并发送到apache camel中的目标端点?   java是否返回多个比较器?   JavaBean IO:Date MMM在CAPS中不解析   当JButton从另一个类单击时,java正在更新JLabel   基类中子类的Java泛型初始化   jakarta ee Java ee制作一个以毫秒为间隔的计时器来发送数据包   json Windows Azure日期格式转换为Java日期