Skip to main content

Simple python wrapper for https://fortniteapi.com/

Project description

FortniteAPI

Simple python library used to get fortnite player statistics, shop, challenges etc.

This library uses https://fortniteapi.com/ api to get all statistics and other stuff.

You don't need any api keys for https://fortniteapi.com/.

Package needs requests library.

Challenges

Used to get seasonal battle pass challenges.

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

Item

Used to specific item by its 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

Note: Sometimes when printing name can cause encoding errors. To prevent that encode item name.

print(item.name.encode('utf-8'))

You can check if item is in store today:

if item.in_store():
    # Do stuff if in store
else:
	# Do stuff if item isn't in store

Checking if item is upcoming:

if item.is_upcoming():
    # Do stuff if is upcoming
else:
	# Do stuff if item is already realesed

Items

Used to get all Fortnite items.

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

Note: Sometimes when printing name can cause encoding errors. To prevent that encode item name.

print(item.name.encode('utf-8'))

News

Used to get Fortnite news.

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

Shop

Used to get daily Fortnite shop.

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

Stats

Used to get player statistics.

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

Statistics are categorized by device. If user haven't played on that device, it will return None Available devices:

  • Keyboard and mouse: keyboard
  • Controller: controller
  • Touch screen: touch

Next you need to provide game mode. Available game modes:

  • Solo: solo
  • Duo: duo
  • Squad: squad
  • Overall: overall

Now you need to provide data type you want.

  • Score: score
  • Wins: wins
  • Matches: matches
  • Kills: kills
  • Winrate: winrate
  • Average kills: avg_kills
  • Deaths: deaths
  • Kill-death ratio: kd

For example if you wanted to access players solo wins while playing with controller:

print(stats.controller.solo.wins) # Prints solo wins while playing with controller

Status

Used to check if Fortnite servers are running.

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

Upcoming

Used to get unrealesed items in 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

User

Used to user's identifier by username.

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

Note: Using print(user.platforms) returns not input devices, but platforms.

Weapons

Used to get all Fortnite weapon statistics.

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for Fortnite-API-com, version 0.0.5
Filename, size File type Python version Upload date Hashes
Filename, size Fortnite-API-com-0.0.5.tar.gz (5.8 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page