A python wrapper for Fortnite-API.com
Project description
Sync/Async Python wrapper for Fortnite-API.com
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 installsorjson
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file fortnite_api-3.2.0.tar.gz
.
File metadata
- Download URL: fortnite_api-3.2.0.tar.gz
- Upload date:
- Size: 63.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8002e6f56cf5445586f007a90114042bd5292bee5778aa54d590b92f8f815fd9 |
|
MD5 | e030cd3581b0abd74e096115203d3134 |
|
BLAKE2b-256 | b9061307eefbdb7951210927dc1d742fec4be524ac72acb7aa87cc294f417c53 |
Provenance
The following attestation bundles were made for fortnite_api-3.2.0.tar.gz
:
Publisher:
pypi.yml
on Fortnite-API/py-wrapper
-
Statement type:
https://in-toto.io/Statement/v1
- Predicate type:
https://docs.pypi.org/attestations/publish/v1
- Subject name:
fortnite_api-3.2.0.tar.gz
- Subject digest:
8002e6f56cf5445586f007a90114042bd5292bee5778aa54d590b92f8f815fd9
- Sigstore transparency entry: 151319180
- Sigstore integration time:
- Predicate type:
File details
Details for the file fortnite_api-3.2.0-py3-none-any.whl
.
File metadata
- Download URL: fortnite_api-3.2.0-py3-none-any.whl
- Upload date:
- Size: 86.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c395190dcf16029218bb458cb2633bac9939d0b58a344b4008c252e0e198ac70 |
|
MD5 | f445baf333630e9818b0c06e655a9432 |
|
BLAKE2b-256 | 31018c34a7e036d07d2713c830cfbee916b1d22f3def6a00dfbcb3b45291aa8a |
Provenance
The following attestation bundles were made for fortnite_api-3.2.0-py3-none-any.whl
:
Publisher:
pypi.yml
on Fortnite-API/py-wrapper
-
Statement type:
https://in-toto.io/Statement/v1
- Predicate type:
https://docs.pypi.org/attestations/publish/v1
- Subject name:
fortnite_api-3.2.0-py3-none-any.whl
- Subject digest:
c395190dcf16029218bb458cb2633bac9939d0b58a344b4008c252e0e198ac70
- Sigstore transparency entry: 151319181
- Sigstore integration time:
- Predicate type: