https://fortniteapi.com的简单python包装/
Fortnite-API-com的Python项目详细描述
对于niteapi
简单的python库,用于获取fortnite播放器的统计信息、商店、挑战等。
这个库使用https://fortniteapi.com/api获取所有统计信息和其他信息。
对于https://fortniteapi.com/不需要任何api键。
包需要请求库。
挑战
用于获得季节性的战斗通行证挑战。
from FortniteAPI import Challenges
base = Challenges(7) # Season number
print(base.season) # Prints season
print(base.current_week) # Prints current season week
print(base.star) # Prints link of a battle star image
challenges = base.get_challenges(5) # Week number
for challenge in challenges:
print(challenge.id) # Prints challenge identifier
print(challenge.challenge) # Prints challenge
print(challenge.count) # Prints challenge amount
print(challenge.stars) # Prints amount of rewarded battle star
print(challenge.difficulty) # Prints challenge difficulty
项目
用于按ID指定的项目。
from FortniteAPI import Item
item = Item("61ea3e9-8438e42-f53d351-e53a5ce")
print(item.id) # Prints item identifier
print(item.name) # Prints item name
print(item.description) # Prints item description
print(item.price) # Prints item price
print(item.type) # Prints item type
print(item.rarity) # Prints item rarity
print(item.transparent) # Prints link of transparent image of item
print(item.background) # Prints link of image with background of item
print(item.information) # Prints link of image with information of item
注意: 有时打印名称时会导致编码错误。以防止对项目名进行编码。
print(item.name.encode('utf-8'))
您可以查看物品今天是否在商店中:
if item.in_store():
# Do stuff if in store
else:
# Do stuff if item isn't in store
检查项目是否即将到来:
if item.is_upcoming():
# Do stuff if is upcoming
else:
# Do stuff if item is already realesed
项目
用于获取所有Fortnite项。
from FortniteAPI import Items
items = Items().get_items()
for item in items:
print(item.id) # Prints item identifier
print(item.name) # Prints item name
print(item.description) # Prints item description
print(item.price) # Prints item price
print(item.rarity) # Prints item rarity
print(item.type) # Prints item type
print(item.image) # Prints link of transparent image of item
print(item.background) # Prints link of image with background of item
print(item.information) # Prints link of image with information of item
注意: 有时打印名称时会导致编码错误。以防止对项目名进行编码。
print(item.name.encode('utf-8'))
新闻
过去常有突发新闻。
from FortniteAPI import News
news = News().get_news()
for new in news:
print(new.title) # Prints news title
print(new.body) # Prints body
print(new.image) # Prints image link
print(new.time) # Prints time when news was posted
购买
以前每天都有复店。
from FortniteAPI import Shop
shop = Shop()
print(shop.date) # Prints shop date
print(shop.vbucks) # Prints link of vbucks icon
items = shop.get_items()
for item in items:
print(item.id) # Prints item identifier
print(item.name) # Prints item name
print(item.price) # Prints item price
print(item.rarity) # Prints item rarity
print(item.type) # Prints item type
print(item.image) # Prints link of transparent image of item
print(item.transparent) # Prints link of transparent image of item
print(item.background) # Prints link of image with background of item
print(item.information) # Prints link of image with information of item
统计信息
用于获取玩家统计信息。
from FortniteAPI import Stats
stats = Stats("4735ce9132924caf8a5b17789b40f79c") # User id
print(stats.user_id) # Prints user id
print(stats.username) # Prints username
print(stats.devices) # Prints available user devices
统计数据按设备分类。如果用户没有在该设备上播放,它将返回None
可用设备:
- 键盘和鼠标:
keyboard
- 控制器:
controller
- 触摸屏:
touch
接下来你需要提供游戏模式。 可用的游戏模式:
- 独奏:
solo
- 二重奏:
duo
- 小队:
squad
- 总的来说:
overall
现在需要提供所需的数据类型。
- 分数:
score
- 获胜:
wins
- 匹配项:
matches
- 杀死:
kills
- WinRate:
winrate
- 平均杀伤力:
avg_kills
- 死亡人数:
deaths
- 致死率:
kd
例如,如果您想在使用控制器时访问玩家solo wins:
print(stats.controller.solo.wins) # Prints solo wins while playing with controller
状态
用于检查Fortnite服务器是否正在运行。
from FortniteAPI import Status
status = Status()
print(status.status) # Prints UP if Fortnite is working properly
print(status.message) # Prints status message
print(status.version) # Prints current version of Fortnite game
print(status.up_since) # Prints the time when Fortnite started running
print(status.uptime) # Prints uptime
print(status.formatted) # Prints formatted uptime
即将推出
用于在Fortnite中获取未读项目。
from FortniteAPI import Upcoming
upcoming = Upcoming()
print(upcoming.vbucks) # Prints link of vbucks icon
items = upcoming.get_items()
for item in items:
print(item.id) # Prints item identifier
print(item.name) # Prints item name
print(item.price) # Prints item price
print(item.rarity) # Prints item rarity
print(item.type) # Prints item type
print(item.image) # Prints link of transparent image of item
print(item.transparent) # Prints link of transparent image of item
print(item.background) # Prints link of image with background of item
print(item.information) # Prints link of image with information of item
用户
用于按用户名显示用户的标识符。
from FortniteAPI import User
user = User("Ninja") # user's username
print(user.id) # Prints user's indentifier
print(user.username) # Prints user's username
print(user.platforms) # Prints user's available platforms
print(user.seasons) # Prints user's seasons
注意:
使用print(user.platforms)
返回的不是输入设备,而是平台。
武器
用于获取所有Fortnite武器统计数据。
from FortniteAPI import Weapons
weapons = Weapons().get_weapons()
for weapon in weapons:
print(weapon.name) # Prints weapon name
print(weapon.rarity) # Prints weapon rarity
print(weapon.head_damage) # Prints weapon headshot damage
print(weapon.body_damage) # Prints weapon bodyshot damage
print(weapon.dps) # Prints weapon damage per second
print(weapon.firerate) # Prints weapon firerate
print(weapon.reload) # Prints weapon reaload time
print(weapon.magazine) # Prints weapon magazine size
print(weapon.image) # Prints link of transparent image of weapon
print(weapon.background) # Prints link of image with background of weapon