Skip to main content

The Python Fortnite API Wrapper

Project description

The Python Fortnite API Wrapper

Discord PyPI

Installation

pip install fortnite

Usage

Setup

Obtaining fortnite and launcher tokens
Looking for an asynchronous client? Check out JakeMakesStuff/aiofortnite

from pfaw import Fortnite, Platform, Mode

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

Player

Return an object containing the attributes name and id.

player = fortnite.player(username='Smitty Werbenjagermanjensen')

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

# prints:
# Smitty Werbenjagermanjensen
# 9c9212603304472d831c03d0978d2bc1

Battle Royale Stats

Creates an object containing various stats for a given player.

stats = fortnite.battle_royale_stats(username='Smitty Werbenjagermanjensen', platform=Platform.pc)

print(f'Solo Wins: {stats.solo.wins}')
print(f'Duo Wins: {stats.duo.wins}')
print(f'Squad Wins: {stats.squad.wins}')
print(f'Lifetime Wins: {stats.all.wins}')


# prints:
# Solo Wins: 1051
# Duo Wins: 1005
# Squad Wins: 210
# Lifetime Wins: 2266

Server Status

Check the status of the Fortnite servers. Return True if up or False if down.

status = fortnite.server_status()

if status:
    print('Servers are UP!')
else:
    print('Servers are DOWN.')

Friends

Return a list of player IDs

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

for friend in smittys_pals:
    print(friend)

News

Return an object containing the attributes common, br, and login.

news = fortnite.news()

for br_news in news.br:
    print(br_news.image)
    print(br_news.title)
    print(br_news.body)

Store

store = fortnite.store()

print(store.refresh_interval_hrs)
print(store.daily_purchase_hrs)
print(store.expiration)

for front in store.storefronts:
    print(front.name)

    for entry in front.catalog_entries:
        print(entry.offer_id)
        print(entry.dev_name)
        print(entry.offer_type)
        print(entry.title)
        print(entry.description)
        print(entry.refundable)

        for price in entry.prices:
            print(price.currency_type)
            print(price.regular_price)
            print(price.final_price)
            print(price.sale_expiration)
            print(price.base_price)

Leaderboard

leaderboard = fortnite.leaderboard(count=10, platform=Platform.pc, mode=Mode.solo)

for player in leaderboard:
    print(f'{player.id} - {player.name} - {player.rank} - {player.value}')

# prints:
# 385c4d9ab7e3498db533ff4d2d9f4c5b - twitch_bogdanakh - 1 - 909
# 155234bbadaa4e8199a7b2d413722290 - TwitchTV.lavak3_ - 2 - 805
# c083d2200d654b25a87c0c48cb76c902 - Agares29_Twitch - 3 - 781
# 0041d08bedc548d9a2230c4a28550594 - Myboosting.com2 - 4 - 736
# 6f5c77adef1c4e47bc33f1f0c8b4b263 - Twitch_DutchHawk - 5 - 728
# e94c3e05284443398803285171550b45 - twitchtvLIKANDOO - 6 - 675
# 13b3c77420da4101a213e1f646b316a9 - Twitch APEXENITH - 7 - 675
# b94176db4c254f9099fb2bd8e8ae0f94 - VaxitylolMIXERtv - 8 - 624
# cfd16ec54126497ca57485c1ee1987dc - SypherPK - 9 - 608
# a9467569462d4149bc438550c03a45c9 - RuralKTmixer.com - 10 - 607

Contributors

A thank you to those who have helped out with this project.

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.8.tar.gz (6.7 kB view details)

Uploaded Source

File details

Details for the file fortnite-0.0.8.tar.gz.

File metadata

  • Download URL: fortnite-0.0.8.tar.gz
  • Upload date:
  • Size: 6.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/39.0.1 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.7

File hashes

Hashes for fortnite-0.0.8.tar.gz
Algorithm Hash digest
SHA256 eead3f9f15162a6dfdd57767aa16109a735d9a91e5a88f85b9a59e8a0c66c578
MD5 55c8dd13ca27eadbf1de8cdb4ef09f06
BLAKE2b-256 9dedf6334aee3d0ff43d3b7068dd9dd1f6c79f04dcf4389fff187418ac44e7ed

See more details on using hashes here.

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