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

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

推荐PyPI第三方库


热门话题
解组时找不到java类   java如何使用生成器模式实现类的Parcelable   java找不到元素“webflow:flowbuilderservices”的声明   java无法使用JexcelAPI写入excel文件   Java反射:如何获得评论?   机器学习Java Weka获取具有给定属性值的所有实例   ant任务将属性文件复制到java构建目录中相应的位置   将指数方程转换为Java代码时出现问题   多线程Java锁定结构最佳模式   java我需要一些关于这些公式实现的帮助   java使用截击在片段上显示图像   数组需要帮助解决Java中的ArrayIndexOutOfBounds异常   java我有时会出错,有时不会?   java改造如何从json对象获取响应   java如何读取Android崩溃日志?   类获取java中的超级接口   java Tomcat连接池配置:数据源类型和“连接太多”错误   java BroadcastReceiver OnReceive无法正常工作   基于JDK8/JRE8+eclipseluna的java-Google应用程序引擎开发   java JSwing简单按钮/JFXPanel布局