Skip to main content

A python wrapper for Fortnite-API.com

Project description

Sync/Async Python wrapper for Fortnite-API.com

Support GitHub issues PyPI PyPI - Python Version PyPI - Downloads Documentation

Welcome to the Fortnite API Python wrapper! This library offers a complete async and sync wrapper around the endpoints of Fortnite-API.com

The library's focus is to provide a simple and easy-to-use interface to interact with the API. The library is designed to be as user-friendly as possible, and it is easy to get started with. If you have any questions or need help, feel free to join the official Discord server.

Installation

Note that Python 3.9 or higher is required.

# Linux/macOS
python3 -m pip install fortnite-api

# Windows
py -3 -m pip install fortnite-api

To install the developer version, you can use the following command:

git clone https://github.com/Fortnite-API/py-wrapper
cd py-wrapper
python3 -m pip install .

Optional Dependencies

  • speed: An optional dependency that installs orjson for faster JSON serialization and deserialization.
# Linux/macOS
python3 -m pip install fortnite-api[speed]

# Windows
py -3 -m pip install fortnite-api[speed]

API Key

For most endpoints, you do not need an API key. However, some endpoints, such as fetching statistics, require an API key. To use these endpoints, you need to set the api_key parameter in the constructor.

import asyncio
import fortnite_api

async def main():
    async with fortnite_api.Client(api_key="your_api_key") as client:
        stats = await client.fetch_br_stats(name='some_username')
        print(stats)

if __name__ == "__main__":
    asyncio.run(main())

Generating an API Key

You can generate an API key on https://dash.fortnite-api.com/account by logging in with your Discord account.

Quick Example

Asynchronous Example

import asyncio
import fortnite_api 

async def main() -> None:
    async with fortnite_api.Client() as client:
        all_cosmetics: fortnite_api.CosmeticsAll = await client.fetch_cosmetics_all()

        for br_cosmetic in all_cosmetics.br:
            print(br_cosmetic.name) 

if __name__ == "__main__":
    asyncio.run(main())

Synchronous Example

import fortnite_api

def main() -> None:
    client = fortnite_api.SyncClient()
    all_cosmetics: fortnite_api.CosmeticsAll = client.fetch_cosmetics_all()

    for br_cosmetic in all_cosmetics.br:
        print(br_cosmetic.name)

if __name__ == "__main__":
    main()

More examples can be found in the examples/ directory of the repository.

Links

Contribute

Every type of contribution is appreciated.

Licenses

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_api-3.2.1.tar.gz (63.7 kB view details)

Uploaded Source

Built Distribution

fortnite_api-3.2.1-py3-none-any.whl (86.9 kB view details)

Uploaded Python 3

File details

Details for the file fortnite_api-3.2.1.tar.gz.

File metadata

  • Download URL: fortnite_api-3.2.1.tar.gz
  • Upload date:
  • Size: 63.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.9.6

File hashes

Hashes for fortnite_api-3.2.1.tar.gz
Algorithm Hash digest
SHA256 427bf5ab9cf7da9c806d2e504a2688b7ca9b19715734934beea6849fd3afd25d
MD5 dc7c3be09b658361a2dfb7a2b4ffc2e7
BLAKE2b-256 f2551dae606258a16bedd3adef05390dd38e69e42fb5b8503e267ee9081ac0be

See more details on using hashes here.

File details

Details for the file fortnite_api-3.2.1-py3-none-any.whl.

File metadata

File hashes

Hashes for fortnite_api-3.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d533103f6d89590c71a3b40c19eae9b37b8f075ca1fb657371e195b2277793b4
MD5 16960b3d4b0eaef1b535492ab891c17d
BLAKE2b-256 f8b912d4337e1500f4f2c8c26c8dafc1c501cf2ac65c40dd4c17b723628e634a

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 Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page