Skip to main content

The Python Fortnite API Wrapper

Project description

A work in progress.

Usage

Setup

import pfaw

fortnite = pfaw.Fortnite(fortnite_token='FORTNITE_TOKEN', launcher_token='LAUNCHER_TOKEN',
                    password='PASSWORD', email='EMAIL')

Get player

Creates a player object containing the attributes name and id.

smitty = fortnite.player('Smitty Werbenjagermanjensen')

print(player.name)
print(player.id)

# prints:
# Smitty Werbenjagermanjensen
# 9c9212603304472d831c03d0978d2bc1

Get battle royale stats

Creates an object containing various stats for a given player.

smitty_solo_pc = fortnite.battle_royale_stats(username='Smitty Werbenjagermanjensen', mode='solo', platform='pc')

print(smitty_solo_pc.score)
print(smitty_solo_pc.matches)
print(smitty_solo_pc.time)
print(smitty_solo_pc.kills)
print(smitty_solo_pc.wins)
print(smitty_solo_pc.top3)
print(smitty_solo_pc.top5)
print(smitty_solo_pc.top6)
print(smitty_solo_pc.top10)
print(smitty_solo_pc.top12)
print(smitty_solo_pc.top25)

# prints:
# 0
# 0
# 0
# 0
# 0
# 0
# 0
# 0
# 0
# 0
# 0

# Smitty isn't very good at Fortnite

Get server status

Checks if the Fortnite servers are up or down. Returns True if up or False if down.

status = fortnite.server_status()

if status:
    print('Good news! The Fortnite servers are online.')
else:
    print('Sad news. The Fortnite servers are down. :(')

Get friends of a player

Returns a list of player objects. As far as I know, this method only works for the authenticated player.

smittys_pals = fortnite.friends(username='Smitty Werbenjagermanjensen')

for friend in smittys_pals:
    print(friend.name)

# prints:
# Shizzy McCreepy
# SD McCrawley

Hopefully more methods to come

Feel free to open an issue or submit a pull request if you have any neat ideas.

Join the Discord for help and suggestions.

Project details


Download files

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

Source Distribution

fortnite-0.0.1.tar.gz (5.6 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page