API Reference

Authentication

As of v1.4.0, you now have to specify which authentication method you want to use for login. The one used up until this version was EmailAndPasswordAuth. However, after that authentication method recently has started to require captcha to login in quite a lot of cases, this is no longer the preferred method in the long run.

The preferred method in the long run is now DeviceAuth. To set up and handle this type of auth, you should use AdvancedAuth. This example demonstrates how you can set up this auth with file storage for the preferred login which is DeviceAuth.

class fortnitepy.EmailAndPasswordAuth(email, password, *, two_factor_code=None, **kwargs)[source]

Authenticates by email and password.

Warning

Some users might experience an error saying captcha was invalid. If this is the case, use AdvancedAuth with an exchange code to generate a device auth.

Parameters
  • email (str) – The accounts email.

  • password (str) – The accounts password.

  • two_factor_code (Optional[int]) – The current two factor code if needed. If not passed here, it will be prompted later.

  • device_id (Optional[str]) – A 32 char hex representing your device.

  • ios_token (Optional[str]) – The ios token to use with authentication. You should generally not need to set this manually.

  • fortnite_token (Optional[str]) – The fortnite token to use with authentication. You should generally not need to set this manually.

class fortnitepy.ExchangeCodeAuth(code, **kwargs)[source]

Authenticates by an exchange code.

Note

The method to get an exchange code has been significantly harder since epic patched the old method of copying the code from one of their own endpoints that could be requested easily in a browser. To obtain an exchange code it is recommended to provide a custom solution like running a selenium process where you log in on https://epicgames.com and then redirect to /id/api/exchange/generate. You can then return the exchange code. You can put this solution in a function and then pass this to exchange_code.

Note

An exchange code only works for a single login within a short timeframe (300 seconds). Therefore you need to get a new code for each login. You can get a new code by refreshing the site.

Parameters
  • code (Union[str, Callable, Awaitable]) – The exchange code or a function/coroutine that when called returns the exchange code.

  • device_id (Optional[str]) – A 32 char hex string representing your device.

  • ios_token (Optional[str]) – The ios token to use with authentication. You should generally not need to set this manually.

  • fortnite_token (Optional[str]) – The fortnite token to use with authentication. You should generally not need to set this manually.

class fortnitepy.AuthorizationCodeAuth(code, **kwargs)[source]

Authenticates by exchange code.

You can get the code from here by logging in and copying the code from the redirectUrl’s query parameters. If you are already logged in and want to change accounts, simply log out at https://www.epicgames.com, log in to the new account and then enter the link above again to generate an authorization code.

Note

An authorization code only works for a single login within a short timeframe (300 seconds). Therefore you need to get a new code for each login. You can get a new code by refreshing the site.

Parameters
  • code (Union[str, Callable, Awaitable]) – The authorization code or a function/coroutine that when called returns the authorization code.

  • device_id (Optional[str]) – A 32 char hex string representing your device.

  • ios_token (Optional[str]) – The ios token to use with authentication. You should generally not need to set this manually.

  • fortnite_token (Optional[str]) – The fortnite token to use with authentication. You should generally not need to set this manually.

class fortnitepy.DeviceAuth(device_id, account_id, secret, **kwargs)[source]

Authenticate with device auth details.

Note

All device auths generated for an account is removed once the accounts password gets reset. If you managed to leak you device_id and secret, simply reset the accounts password and everything should be fine.

Parameters
  • device_id (str) – The device id.

  • account_id (str) – The account’s id.

  • secret (str) – The secret.

  • ios_token (Optional[str]) – The ios token to use with authentication. You should generally not need to set this manually.

  • fortnite_token (Optional[str]) – The fortnite token to use with authentication. You should generally not need to set this manually.

class fortnitepy.RefreshTokenAuth(refresh_token, **kwargs)[source]

Authenticates by the passed launcher refresh token.

Parameters

refresh_token (str) – A valid launcher refresh token.

class fortnitepy.AdvancedAuth(email=None, password=None, two_factor_code=None, exchange_code=None, authorization_code=None, device_id=None, account_id=None, secret=None, prompt_exchange_code=False, prompt_authorization_code=False, prompt_code_if_invalid=False, prompt_code_if_throttled=False, delete_existing_device_auths=False, **kwargs)[source]

Authenticates by the available data in the following order:

1. By DeviceAuth if device_id, account_id and secret are present. 2. By EmailAndPasswordAuth if email and password is present. If authentication fails because of required captcha, it then attempts to authenticate with the next step. 3. ExchangeCodeAuth is tried if exchange_code is present or if prompt_exchange_code is True. 4. AuthorizationCodeAuth is tried if authorization_code is present or if prompt_authorization_code is True.

If the authentication was not done by step 1, a device auth is automatically generated and the details will be dispatched to event_device_auth_generate(). It is important to store these values somewhere since they can be used for easier logins.

Parameters
  • email (Optional[str]) – The email to use for the login.

  • password (Optional[str]) – The password to use for the login.

  • two_factor_code (Optional[int]) – The two factor code to use for the login if needed. If this is not passed but later needed, you will be prompted to enter it in the console.

  • exchange_code (Optional[Union[str, Callable, Awaitable]]) – The exchange code or a function/coroutine that when called returns the exchange code.

  • authorization_code (Optional[Union[str, Callable, Awaitable]]) – The authorization code or a function/coroutine that when called returns the authorization code.

  • device_id (Optional[str]) – The device id to use for the login.

  • account_id (Optional[str]) – The account id to use for the login.

  • secret (Optional[str]) – The secret to use for the login.

  • prompt_exchange_code (bool) –

    If this is set to True and no exchange code is passed, you will be prompted to enter the exchange code in the console if needed.

    Note

    Both prompt_exchange_code and prompt_authorization_code cannot be True at the same time.

  • prompt_authorization_code (bool) –

    If this is set to True and no authorization code is passed, you will be prompted to enter the authorization code in the console if needed.

    Note

    Both prompt_exchange_code and prompt_authorization_code cannot be True at the same time.

  • prompt_code_if_invalid (bool) –

    Whether or not to prompt a code if the device auth details was invalid. If this is False then the regular AuthException is raised instead.

    Note

    This only works if prompt_exchange_code or prompt_authorization_code is True.

  • prompt_code_if_throttled (bool) –

    If this is set to True and you receive a throttling response, you will be prompted to enter a code in the console.

    Note

    This only works if prompt_exchange_code or prompt_authorization_code is True.

  • delete_existing_device_auths (bool) – Whether or not to delete all existing device auths when a new is created.

  • ios_token (Optional[str]) – The ios token to use with authentication. You should generally not need to set this manually.

  • fortnite_token (Optional[str]) – The fortnite token to use with authentication. You should generally not need to set this manually.

Clients

BasicClient

class fortnitepy.BasicClient[source]

Represents a basic stripped down version of Client. You might want to use this client if your only goal is to make simple requests like user or stats fetching.

This client does not support the following:
Supported events by this client:
Parameters
  • auth (Auth) – The authentication method to use. You can read more about available authentication methods here.

  • http_connector (aiohttp.BaseConnector) – The connector to use for http connection pooling.

  • http_retry_config (Optional[HTTPRetryConfig]) – The config to use for http retries.

  • build (str) – The build used by Fortnite. Defaults to a valid but maybe outdated value.

  • os (str) – The os version string to use in the user agent. Defaults to Windows/10.0.17134.1.768.64bit which is valid no matter which platform you have set.

  • cache_users (bool) – Whether or not the library should cache User objects. Disable this if you are running a program with lots of users as this could potentially take a big hit on the memory usage. Defaults to True.

user

The user the client is logged in as.

Type

ClientUser

register_connectors(http_connector=None)[source]

This can be used to register a http connector after the client has already been initialized. It must however be called before start() has been called, or in event_before_start().

Warning

Connectors passed will not be closed on shutdown. You must close them yourself if you want a graceful shutdown.

Parameters

http_connector (aiohttp.BaseConnector) – The connector to use for the http session.

run()[source]

This function starts the loop and then calls start() for you. If your program already has an asyncio loop setup, you should use start() instead.

Warning

This function is blocking and should be the last function to run.

Raises
  • AuthException – Raised if invalid credentials in any form was passed or some other misc failure.

  • HTTPException – A request error occured while logging in.

start(dispatch_ready=True)[source]

This function is a coroutine.

Starts the client and logs into the specified user.

This method can be used as a coroutine or an async context manager, depending on your needs.

How to use as an async context manager: ::
async with client.start():

user = await client.fetch_user(‘Ninja’) print(user.display_name)

If you want to use it as an async context manager, but also keep the client running forever, you can await the return of start like this:

async with client.start() as future:
    user = await client.fetch_user('Ninja')
    print(user.display_name)

    await future  # Nothing after this line will run.

Warning

This method is blocking if you await it as a coroutine or you await the return future. This means that no code coming after will run until the client is closed. When the client is ready it will dispatch event_ready().

Parameters

dispatch_ready (bool) – Whether or not the client should dispatch the ready event when ready.

Raises
  • AuthException – Raised if invalid credentials in any form was passed or some other misc failure.

  • HTTPException – A request error occured while logging in.

await close(*, close_http=True, dispatch_close=True)[source]

This function is a coroutine.

Logs the user out and closes running services.

Parameters
  • close_http (bool) – Whether or not to close the clients aiohttp.ClientSession when logged out.

  • dispatch_close (bool) – Whether or not to dispatch the close event.

Raises

HTTPException – An error occured while logging out.

is_closed()[source]

bool: Whether the client is running or not.

await restart()[source]

This function is a coroutine.

Restarts the client completely. All events received while this method runs are dispatched when it has finished.

Raises
  • AuthException – Raised if invalid credentials in any form was passed or some other misc failure.

  • HTTPException – A request error occured while logging in.

is_ready()[source]

Specifies if the internal state of the client is ready.

Returns

True if the internal state is ready else False

Return type

bool

await wait_until_ready()[source]

This function is a coroutine.

Waits until the internal state of the client is ready.

await wait_until_closed()[source]

This function is a coroutine.

Waits until the client is fully closed.

await fetch_user_by_display_name(display_name, *, cache=False, raw=False)[source]

This function is a coroutine.

Fetches a user from the passed display name.

Parameters
  • display_name (str) – The display name of the user you want to fetch the user for.

  • cache (bool) –

    If set to True it will try to get the user from the friends or user cache.

    Note

    Setting this parameter to False will make it an api call.

  • raw (bool) –

    If set to True it will return the data as you would get it from the api request.

    Note

    Setting raw to True does not work with cache set to True.

Raises

HTTPException – An error occured while requesting the user.

Returns

The user requested. If not found it will return None.

Return type

Optional[User]

await fetch_users_by_display_name(display_name, *, raw=False)[source]

This function is a coroutine.

Fetches all users including external users (accounts from other platforms) that matches the given the display name.

Warning

This function is not for requesting multiple users by multiple display names. Use BasicClient.fetch_user() for that.

Parameters
  • display_name (str) – The display name of the users you want to get.

  • raw (bool) – If set to True it will return the data as you would get it from the api request. Defaults to ``False``

Raises

HTTPException – An error occured while requesting the user.

Returns

A list containing all payloads found for this user.

Return type

List[User]

await fetch_user(user, *, cache=False, raw=False)[source]

This function is a coroutine.

Fetches a single user by the given id/displayname.

Parameters
  • user (str) – Id or display name

  • cache (bool) –

    If set to True it will try to get the user from the friends or user cache and fall back to an api request if not found.

    Note

    Setting this parameter to False will make it an api call.

  • raw (bool) –

    If set to True it will return the data as you would get it from the api request.

    Note

    Setting raw to True does not work with cache set to True.

Raises

HTTPException – An error occured while requesting the user.

Returns

The user requested. If not found it will return None

Return type

Optional[User]

await fetch_users(users, *, cache=False, raw=False)[source]

This function is a coroutine.

Fetches multiple users at once by the given ids/displaynames.

Parameters
  • users (Iterable[str]) – An iterable containing ids/displaynames.

  • cache (bool) –

    If set to True it will try to get the users from the friends or user cache and fall back to an api request if not found.

    Note

    Setting this parameter to False will make it an api call.

  • raw (bool) –

    If set to True it will return the data as you would get it from the api request.

    Note

    Setting raw to True does not work with cache set to True.

Raises

HTTPException – An error occured while requesting user information.

Returns

Users requested. Only users that are found gets returned.

Return type

List[User]

await fetch_user_by_email(email, *, cache=False, raw=False)[source]

This function is a coroutine.

Fetches a single user by the email.

Warning

Because of epicgames throttling policy, you can only do this request three times in a timespan of 600 seconds. If you were to do more than three requests in that timespan, a HTTPException would be raised.

Parameters
  • email (str) – The email of the account you are requesting.

  • cache (bool) –

    If set to True it will try to get the user from the friends or user cache and fall back to an api request if not found.

    Note

    This method does two api requests but with this set to False only one request will be done as long as the user is found in one of the caches.

  • raw (bool) –

    If set to True it will return the data as you would get it from the api request.

    Note

    Setting raw to True does not work with cache set to True.

Raises

HTTPException – An error occured while requesting the user.

Returns

The user requested. If not found it will return None

Return type

Optional[User]

await search_users(prefix, platform)[source]

This function is a coroutine.

Searches after users by a prefix and returns up to 100 matches.

Parameters
  • prefix (str) –

    The prefix you want to search by. The prefix is case insensitive.
    Example: Tfue will return Tfue’s user + up to 99 other

    users which have display names that start with or match exactly to Tfue like Tfue_Faze dequan.

  • platform (UserSearchPlatform) –

    The platform you wish to search by.

    Note

    The platform is only important for prefix matches. All exact matches are returned regardless of which platform is specified.

Raises

HTTPException – An error occured while requesting.

Returns

An ordered list of users that matched the prefix.

Return type

List[UserSearchEntry]

await fetch_avatars(users)[source]

This function is a coroutine.

Fetches the avatars of the provided user ids.

Warning

You can only fetch avatars of friends. That means that the bot has to be friends with the users you are requesting the avatars of.

Parameters

users (List[str]) – A list containing user ids.

Raises

HTTPException – An error occured while requesting.

Returns

A dict containing avatars mapped to their user id.

Return type

Dict[str, Avatar]

await search_sac_by_slug(slug)[source]

This function is a coroutine.

Searches for an owner of slug + retrieves owners of similar slugs.

Parameters

slug (str) – The slug (support a creator code) you wish to search for.

Raises

HTTPException – An error occured while requesting fortnite’s services.

Returns

An ordered list of users who matched the exact or slightly modified slug.

Return type

List[SacSearchEntryUser]

get_user(user_id)[source]

Tries to get a user from the user cache by the given user id.

Parameters

user_id (str) – The id of the user.

Returns

The user if found, else None

Return type

Optional[User]

await fetch_blocklist()[source]

This function is a coroutine.

Retrieves the blocklist with an api call.

Raises

HTTPException – An error occured while fetching blocklist.

Returns

List of ids

Return type

List[str]

await block_user(user_id)[source]

This function is a coroutine.

Blocks a user by a given user id.

Parameters

user_id (str) – The id of the user you want to block.

Raises

HTTPException – Something went wrong when trying to block this user.

await unblock_user(user_id)[source]

This function is a coroutine.

Unblocks a user by a given user id.

Parameters

user_id (str) – The id of the user you want to unblock

Raises

HTTPException – Something went wrong when trying to unblock this user.

await add_friend(user_id)[source]

This function is a coroutine.

Sends a friend request to the specified user id.

Parameters

user_id (str) – The id of the user you want to add.

Raises
  • NotFound – The specified user does not exist.

  • DuplicateFriendship – The client is already friends with this user.

  • FriendshipRequestAlreadySent – The client has already sent a friendship request that has not been handled yet by the user.

  • MaxFriendshipsExceeded – The client has hit the max amount of friendships a user can have at a time. For most accounts this limit is set to 1000 but it could be higher for others.

  • InviteeMaxFriendshipsExceeded – The user you attempted to add has hit the max amount of friendships a user can have at a time.

  • InviteeMaxFriendshipRequestsExceeded – The user you attempted to add has hit the max amount of friendship requests a user can have at a time. This is usually 700 total requests.

  • Forbidden – The client is not allowed to send friendship requests to the user because of the users settings.

  • HTTPException – An error occured while requesting to add this friend.

await accept_friend(user_id)[source]

This function is a coroutine.

Accepts a request.

Parameters

user_id (str) – The id of the user you want to accept.

Raises
  • NotFound – The specified user does not exist.

  • DuplicateFriendship – The client is already friends with this user.

  • FriendshipRequestAlreadySent – The client has already sent a friendship request that has not been handled yet by the user.

  • Forbidden – The client is not allowed to send friendship requests to the user because of the users settings.

  • HTTPException – An error occured while requesting to accept this friend.

await remove_or_decline_friend(user_id)[source]

This function is a coroutine.

Removes a friend by the given id.

Parameters

user_id (str) – The id of the friend you want to remove.

Raises

HTTPException – Something went wrong when trying to remove this friend.

wait_for(event, *, check=None, timeout=None)[source]

This function is a coroutine.

Waits for an event to be dispatch.

In case the event returns more than one arguments, a tuple is passed containing the arguments.

Examples

This example waits for the author of a FriendMessage to say hello.:

@client.event
async def event_friend_message(message):
    await message.reply('Say hello!')

    def check_function(m):
        return m.author.id == message.author.id

    msg = await client.wait_for('message', check=check_function, timeout=60)
    await msg.reply('Hello {0.author.display_name}!'.format(msg))

This example waits for the the leader of a party to promote the bot after joining and then sets a new custom key:

@client.event
async def event_party_member_join(member):

    # checks if the member that joined is the UserClient
    if member.id != client.user.id:
        return

    def check(m):
        return m.id == client.user.id

    try:
        await client.wait_for('party_member_promote', check=check, timeout=120)
    except asyncio.TimeoutError:
        await member.party.send('You took too long to promote me!')

    await member.party.set_custom_key('my_custom_key_123')
Parameters
  • event (str) –

    The name of the event.

    Note

    The name of the event must be without the event_

    prefix. | | Wrong = event_friend_message. | Correct = friend_message.

  • check (Optional[Callable]) – A predicate to check what to wait for. Defaults to a predicate that always returns True. This means it will return the first result unless you pass another predicate.

  • timeout (int) – How many seconds to wait for before asyncio.TimeoutError is raised. Defaults to ``None`` which means it will wait forever.

Raises

asyncio.TimeoutError – No event was retrieved in the time you specified.

Returns

Returns arguments based on the event you are waiting for. An event might return no arguments, one argument or a tuple of arguments. Check the event reference <fortnitepy-events-api> for more information about the returning arguments.

Return type

Any

add_event_handler(event, coro)[source]

Registers a coroutine as an event handler. You can register as many coroutines as you want to a single event.

Parameters
  • event (str) – The name of the event you want to register this coro for.

  • coro (coroutine) – The coroutine to function as the handler for the specified event.

Raises

TypeError – The function passed to coro is not a coroutine.

remove_event_handler(event, coro)[source]

Removes a coroutine as an event handler.

Parameters
  • event (str) – The name of the event you want to remove this coro for.

  • coro (coroutine) – The coroutine that already functions as a handler for the specified event.

event(event_or_coro=None)[source]

A decorator to register an event.

Note

You do not need to decorate events in a subclass of BasicClient but the function names of event handlers must follow this format event_<event>.

Usage:

@client.event
async def event_friend_message(message):
    await message.reply('Thanks for your message!')

@client.event('friend_message')
async def my_message_handler(message):
    await message.reply('Thanks for your message!')
Raises
  • TypeError – The decorated function is not a coroutine.

  • TypeError – Event is not specified as argument or function name with event prefix.

await fetch_br_stats(user_id, *, start_time=None, end_time=None)[source]

This function is a coroutine.

Gets Battle Royale stats the specified user.

Parameters
  • user_id (str) – The id of the user you want to fetch stats for.

  • start_time (Optional[Union[int, datetime.datetime, SeasonStartTimestamp]]) – The UTC start time of the time period to get stats from. Must be seconds since epoch, :class:`datetime.datetime` or a constant from SeasonEndTimestamp Defaults to None

  • end_time (Optional[Union[int, datetime.datetime, SeasonEndTimestamp]]) – The UTC end time of the time period to get stats from. Must be seconds since epoch, :class:`datetime.datetime` or a constant from SeasonEndTimestamp Defaults to None

Raises
  • Forbidden

    The user has chosen to be hidden from public stats by disabling the fortnite setting below. | Settings -> Account and Privacy -> Show on career     leaderboard

  • HTTPException – An error occured while requesting.

Returns

An object representing the stats for this user. If the user was not found None is returned.

Return type

StatsV2

await fetch_multiple_br_stats(user_ids, stats, *, start_time=None, end_time=None)[source]

This function is a coroutine.

Gets Battle Royale stats for multiple users at the same time.

Note

This function is not the same as doing fetch_br_stats() for multiple users. The expected return for this function would not be all the stats for the specified users but rather the stats you specify.

Example usage:

async def stat_function():
    stats = [
        fortnitepy.StatsV2.create_stat('placetop1', fortnitepy.V2Input.KEYBOARDANDMOUSE, 'defaultsolo'),
        fortnitepy.StatsV2.create_stat('kills', fortnitepy.V2Input.KEYBOARDANDMOUSE, 'defaultsolo'),
        fortnitepy.StatsV2.create_stat('matchesplayed', fortnitepy.V2Input.KEYBOARDANDMOUSE, 'defaultsolo')
    ]

    # get the users and create a list of their ids.
    users = await self.fetch_users(['Ninja', 'DrLupo'])
    user_ids = [u.id for u in users] + ['NonValidUserIdForTesting']

    data = await self.fetch_multiple_br_stats(user_ids=user_ids, stats=stats)
    for id, res in data.items():
        if res is not None:
            print('ID: {0} | Stats: {1}'.format(id, res.get_stats()))
        else:
            print('ID: {0} not found.'.format(id))

# Example output:
# ID: 463ca9d604524ce38071f512baa9cd70 | Stats: {'keyboardmouse': {'defaultsolo': {'wins': 759, 'kills': 28093, 'matchesplayed': 6438}}}
# ID: 3900c5958e4b4553907b2b32e86e03f8 | Stats: {'keyboardmouse': {'defaultsolo': {'wins': 1763, 'kills': 41375, 'matchesplayed': 7944}}}
# ID: 4735ce9132924caf8a5b17789b40f79c | Stats: {'keyboardmouse': {'defaultsolo': {'wins': 1888, 'kills': 40784, 'matchesplayed': 5775}}}
# ID: NonValidUserIdForTesting not found.
Parameters
  • user_ids (List[str]) – A list of ids you are requesting the stats for.

  • stats (List[str]) –

    A list of stats to get for the users. Use StatsV2.create_stat() to create the stats.

    Example:

    [
        fortnitepy.StatsV2.create_stat('placetop1', fortnitepy.V2Input.KEYBOARDANDMOUSE, 'defaultsolo'),
        fortnitepy.StatsV2.create_stat('kills', fortnitepy.V2Input.KEYBOARDANDMOUSE, 'defaultsolo'),
        fortnitepy.StatsV2.create_stat('matchesplayed', fortnitepy.V2Input.KEYBOARDANDMOUSE, 'defaultsolo')
    ]
    

  • start_time (Optional[Union[int, datetime.datetime, SeasonStartTimestamp]]) – The UTC start time of the time period to get stats from. Must be seconds since epoch, :class:`datetime.datetime` or a constant from SeasonEndTimestamp Defaults to None

  • end_time (Optional[Union[int, datetime.datetime, SeasonEndTimestamp]]) – The UTC end time of the time period to get stats from. Must be seconds since epoch, :class:`datetime.datetime` or a constant from SeasonEndTimestamp Defaults to None

Raises

HTTPException – An error occured while requesting.

Returns

A mapping where StatsV2 is bound to its owners id. If a userid was not found then the value bound to that userid will be None.

Note

If a users stats is missing in the returned mapping it means that the user has opted out of public leaderboards and that the client therefore does not have permissions to requests their stats.

Return type

Dict[str, Optional[StatsV2]]

await fetch_multiple_br_stats_collections(user_ids, collection=None, *, start_time=None, end_time=None)[source]

This function is a coroutine.

Gets Battle Royale stats collections for multiple users at the same time.

Parameters
  • user_ids (List[str]) – A list of ids you are requesting the stats for.

  • collection (StatsCollectionType) – The collection to receive. Collections are predefined stats that it attempts to request.

  • start_time (Optional[Union[int, datetime.datetime, SeasonStartTimestamp]]) – The UTC start time of the time period to get stats from. Must be seconds since epoch, :class:`datetime.datetime` or a constant from SeasonEndTimestamp Defaults to None

  • end_time (Optional[Union[int, datetime.datetime, SeasonEndTimestamp]]) – The UTC end time of the time period to get stats from. Must be seconds since epoch, :class:`datetime.datetime` or a constant from SeasonEndTimestamp Defaults to None

Raises

HTTPException – An error occured while requesting.

Returns

A mapping where StatsCollection is bound to its owners id. If a userid was not found then the value bound to that userid will be None.

Note

If a users stats is missing in the returned mapping it means that the user has opted out of public leaderboards and that the client therefore does not have permissions to requests their stats.

Return type

Dict[str, Optional[StatsCollection]]

await fetch_multiple_battlepass_levels(users, season, *, start_time=None, end_time=None)[source]

This function is a coroutine.

Fetches multiple users battlepass level.

Parameters
  • users (List[str]) – List of user ids.

  • season (int) –

    The season number to request the battlepass levels for.

    Warning

    If you are requesting the previous season and the new season has not been added to the library yet (check SeasonStartTimestamp), you have to manually include the previous seasons end timestamp in epoch seconds.

  • start_time (Optional[Union[int, datetime.datetime, SeasonStartTimestamp]]) – The UTC start time of the window to get the battlepass level from. Must be seconds since epoch, :class:`datetime.datetime` or a constant from SeasonEndTimestamp Defaults to None

  • end_time (Optional[Union[int, datetime.datetime, SeasonEndTimestamp]]) – The UTC end time of the window to get the battlepass level from. Must be seconds since epoch, :class:`datetime.datetime` or a constant from SeasonEndTimestamp Defaults to None

Raises

HTTPException – An error occured while requesting.

Returns

Users battlepass level mapped to their account id. Returns None if no battlepass level was found. If a user has career board set to private, he/she will not appear in the result. Therefore you should never expect a user to be included.

Note

The decimals are the percent progress to the next level. E.g. 208.63 -> Level 208 and 63% on the way to 209.

Note

If a users battlepass level is missing in the returned mapping it means that the user has opted out of public leaderboards and that the client therefore does not have permissions to requests their stats.

Return type

Dict[str, Optional[float]]

await fetch_battlepass_level(user_id, *, season, start_time=None, end_time=None)[source]

This function is a coroutine.

Fetches a users battlepass level.

Parameters
  • user_id (str) – The user id to fetch the battlepass level for.

  • season (int) –

    The season number to request the battlepass level for.

    Warning

    If you are requesting the previous season and the new season has not been added to the library yet (check SeasonStartTimestamp), you have to manually include the previous seasons end timestamp in epoch seconds.

  • start_time (Optional[Union[int, datetime.datetime, SeasonStartTimestamp]]) – The UTC start time of the window to get the battlepass level from. Must be seconds since epoch, :class:`datetime.datetime` or a constant from SeasonEndTimestamp Defaults to None

  • end_time (Optional[Union[int, datetime.datetime, SeasonEndTimestamp]]) – The UTC end time of the window to get the battlepass level from. Must be seconds since epoch, :class:`datetime.datetime` or a constant from SeasonEndTimestamp Defaults to None

Raises
Returns

The users battlepass level. None is returned if the user has not played any real matches this season.

Note

The decimals are the percent progress to the next level. E.g. 208.63 -> Level 208 and 63% on the way to 209.

Return type

Optional[float]

await fetch_leaderboard(stat)[source]

This function is a coroutine.

Fetches the leaderboard for a stat.

Warning

For some weird reason, the only valid stat you can pass is one with placetop1 (wins is also accepted).

Example usage:

async def get_leaderboard():
    stat = fortnitepy.StatsV2.create_stat(
        'wins',
        fortnitepy.V2Input.KEYBOARDANDMOUSE,
        'defaultsquad'
    )

    data = await client.fetch_leaderboard(stat)

    for placement, entry in enumerate(data):
        print('[{0}] Id: {1} | Wins: {2}'.format(
            placement, entry['account'], entry['value']))
Parameters

stat (str) – The stat you are requesting the leaderboard entries for. You can use StatsV2.create_stat() to create this string.

Raises
  • ValueError – You passed an invalid/non-accepted stat argument.

  • HTTPException – An error occured when requesting.

Returns

List of dictionaries containing entry data. Example return:

{
    'account': '4480a7397f824fe4b407077fb9397fbb',
    'value': 5082
}

Return type

List[Dict[str, Union[str, int]]]

await fetch_party(party_id)[source]

This function is a coroutine.

Fetches a party by its id.

Parameters

party_id (str) – The id of the party.

Raises

Forbidden – You are not allowed to look up this party.

Returns

The party that was fetched. None if not found.

Return type

Optional[Party]

await fetch_lightswitch_status(service_id='Fortnite')[source]

This function is a coroutine.

Fetches the lightswitch status of an epicgames service.

Parameters

service_id (str) – The service id to check status for.

Raises
  • ValueError – The returned data was empty. Most likely because service_id is not valid.

  • HTTPException – An error occured when requesting.

Returns

True if service is up else False

Return type

bool

await fetch_item_shop()[source]

This function is a coroutine.

Fetches the current item shop.

Example:

# fetches all CIDs (character ids) of of the current item shop.
async def get_current_item_shop_cids():
    store = await client.fetch_item_shop()

    cids = []
    for item in store.featured_items + store.daily_items:
        for grant in item.grants:
            if grant['type'] == 'AthenaCharacter':
                cids.append(grant['asset'])

    return cids
Raises

HTTPException – An error occured when requesting.

Returns

Object representing the data from the current item shop.

Return type

Store

await fetch_br_news()[source]

This function is a coroutine.

Fetches news for the Battle Royale gamemode.

Raises

HTTPException – An error occured when requesting.

Returns

List[BattleRoyaleNewsPost]

Return type

list

await fetch_br_playlists()[source]

This function is a coroutine.

Fetches all playlists registered on Fortnite. This includes all previous gamemodes that is no longer active.

Raises

HTTPException – An error occured while requesting.

Returns

List containing all playlists registered on Fortnite.

Return type

List[Playlist]

await fetch_active_ltms(region)[source]

This function is a coroutine.

Fetches active LTMs for a specific region.

Parameters

region (Region) – The region to request active LTMs for.

Raises

HTTPException – An error occured while requesting.

Returns

List of internal playlist names. Returns an empty list of none LTMs are for the specified region.

Return type

List[str]

Client

class fortnitepy.Client[source]

Represents the client connected to Fortnite and EpicGames’ services.

Parameters
  • auth (Auth) – The authentication method to use. You can read more about available authentication methods here.

  • http_connector (aiohttp.BaseConnector) – The connector to use for http connection pooling.

  • ws_connector (aiohttp.BaseConnector) – The connector to use for websocket connection pooling. This could be the same as the above connector.

  • status (str) – The status you want the client to send with its presence to friends. Defaults to: Battle Royale Lobby - {party playercount} / {party max playercount}

  • away (AwayStatus) – The away status the client should use for its presence. Defaults to AwayStatus.ONLINE.

  • platform (Platform) – The platform you want the client to display as its source. Defaults to Platform.WINDOWS.

  • net_cl (str) – The current net cl used by the current Fortnite build. Named netCL in official logs. Defaults to an empty string which is the recommended usage as of v0.9.0 since you then won’t need to update it when a new update is pushed by Fortnite.

  • party_version (int) – The party version the client should use. This value determines which version should be able to join the party. If a user attempts to join the clients party with a different party version than the client, then an error will be visible saying something by the lines of “Their party of Fortnite is older/newer than yours”. If you experience this error I recommend incrementing the default set value by one since the library in that case most likely has yet to be updated. Defaults to 3 (As of November 3rd 2020).

  • default_party_config (DefaultPartyConfig) – The party configuration used when creating parties. If not specified, the client will use the default values specified in the data class.

  • default_party_member_config (DefaultPartyMemberConfig) – The party member configuration used when creating parties. If not specified, the client will use the default values specified in the data class.

  • http_retry_config (Optional[HTTPRetryConfig]) – The config to use for http retries.

  • build (str) – The build used by Fortnite. Defaults to a valid but maybe outdated value.

  • os (str) – The os version string to use in the user agent. Defaults to Windows/10.0.17134.1.768.64bit which is valid no matter which platform you have set.

  • service_host (str) – The host used by Fortnite’s XMPP services.

  • service_domain (str) – The domain used by Fortnite’s XMPP services.

  • service_port (int) – The port used by Fortnite’s XMPP services.

  • cache_users (bool) – Whether or not the library should cache User objects. Disable this if you are running a program with lots of users as this could potentially take a big hit on the memory usage. Defaults to True.

  • fetch_user_data_in_events (bool) –

    Whether or not user data should be fetched in event processing. Disabling this might be useful for larger applications that deals with possibly being rate limited on their ip. Defaults to True.

    Warning

    Keep in mind that if this option is disabled, there is a big chance that display names, external auths and more might be missing or simply is None on objects deriving from User. Keep in mind that User.id always will be available. You can use User.fetch() to update all missing attributes.

  • wait_for_member_meta_in_events (bool) – Whether or not the client should wait for party member meta (information about outfit, backpack etc.) before dispatching events like event_party_member_join(). If this is disabled then member objects in the events won’t have the correct meta. Defaults to True.

  • leave_party_at_shutdown (bool) – Whether or not the client should leave its current party at shutdown. If this is set to false, then the client will attempt to reconnect to the party on a startup. If DefaultPartyMemberConfig.offline_ttl is exceeded before a reconnect is attempted, then the client will create a new party at startup.

user

The user the client is logged in as.

Type

ClientUser

party

The party the client is currently connected to.

Type

ClientParty

register_connectors(http_connector=None, ws_connector=None)[source]

This can be used to register connectors after the client has already been initialized. It must however be called before start() has been called, or in event_before_start().

Warning

Connectors passed will not be closed on shutdown. You must close them yourself if you want a graceful shutdown.

Parameters
friends

A list of the clients friends.

Type

List[Friend]

friend_count

The amount of friends the bot currently has.

Type

int

pending_friends

List[Union[IncomingPendingFriend, OutgoingPendingFriend]]: A list of all of the clients pending friends.

Note

Pending friends can be both incoming (pending friend sent the request to the bot) or outgoing (the bot sent the request to the pending friend). You must check what kind of pending friend an object is by their attributes incoming or outgoing.

pending_friend_count

The amount of pending friends the bot currently has.

Type

int

incoming_pending_friends

A list of the clients incoming pending friends.

Type

List[IncomingPendingFriend]

incoming_pending_friend_count

The amount of active incoming pending friends the bot currently has received.

Type

int

outgoing_pending_friends

A list of the clients outgoing pending friends.

Type

List[OutgoingPendingFriend]

outgoing_pending_friend_count

The amount of active outgoing pending friends the bot has sent.

Type

int

blocked_users

A list of the users client has as blocked.

Type

List[BlockedUser]

blocked_user_count

The amount of blocked users the bot currently has blocked.

Type

int

presences

A list of the last presences from currently online friends.

Type

List[Presence]

get_user(user_id)[source]

Tries to get a user from the user cache by the given user id.

Parameters

user_id (str) – The id of the user.

Returns

The user if found, else None

Return type

Optional[User]

get_friend(user_id)[source]

Tries to get a friend from the friend cache by the given user id.

Parameters

user_id (str) – The id of the friend.

Returns

The friend if found, else None

Return type

Optional[Friend]

get_pending_friend(user_id)[source]

Tries to get a pending friend from the pending friend cache by the given user id.

Parameters

user_id (str) – The id of the pending friend.

Returns

get_incoming_pending_friend(user_id)[source]

Tries to get an incoming pending friend from the pending friends cache by the given user id.

Parameters

user_id (str) – The id of the incoming pending friend.

Returns

The incoming pending friend if found, else None.

Return type

Optional[IncomingPendingFriend]

get_outgoing_pending_friend(user_id)[source]

Tries to get an outgoing pending friend from the pending friends cache by the given user id.

Parameters

user_id (str) – The id of the outgoing pending friend.

Returns

The outgoing pending friend if found, else None.

Return type

Optional[OutgoingPendingFriend]

get_blocked_user(user_id)[source]

Tries to get a blocked user from the blocked users cache by the given user id.

Parameters

user_id (str) – The id of the blocked user.

Returns

The blocked user if found, else None

Return type

Optional[BlockedUser]

get_presence(user_id)[source]

Tries to get the latest received presence from the presence cache.

Parameters

user_id (str) – The id of the friend you want the last presence of.

Returns

The presence if found, else None

Return type

Optional[Presence]

has_friend(user_id)[source]

Checks if the client is friends with the given user id.

Parameters

user_id (str) – The id of the user you want to check.

Returns

True if user is friends with the client else False

Return type

bool

is_pending(user_id)[source]

Checks if the given user id is a pending friend of the client.

Parameters

user_id (str) – The id of the user you want to check.

Returns

True if user is a pending friend else False

Return type

bool

is_blocked(user_id)[source]

Checks if the given user id is blocked by the client.

Parameters

user_id (str) – The id of the user you want to check.

Returns

True if user is blocked else False

Return type

bool

await accept_friend(user_id)[source]

This function is a coroutine.

Warning

Do not use this method to send a friend request. It will then not return until the friend request has been accepted by the user.

Accepts a request.

Parameters

user_id (str) – The id of the user you want to accept.

Raises
  • NotFound – The specified user does not exist.

  • DuplicateFriendship – The client is already friends with this user.

  • FriendshipRequestAlreadySent – The client has already sent a friendship request that has not been handled yet by the user.

  • Forbidden – The client is not allowed to send friendship requests to the user because of the users settings.

  • HTTPException – An error occured while requesting to accept this friend.

Returns

Object of the friend you just added.

Return type

Friend

add_event_handler(event, coro)[source]

Registers a coroutine as an event handler. You can register as many coroutines as you want to a single event.

Parameters
  • event (str) – The name of the event you want to register this coro for.

  • coro (coroutine) – The coroutine to function as the handler for the specified event.

Raises

TypeError – The function passed to coro is not a coroutine.

await add_friend(user_id)[source]

This function is a coroutine.

Sends a friend request to the specified user id.

Parameters

user_id (str) – The id of the user you want to add.

Raises
  • NotFound – The specified user does not exist.

  • DuplicateFriendship – The client is already friends with this user.

  • FriendshipRequestAlreadySent – The client has already sent a friendship request that has not been handled yet by the user.

  • MaxFriendshipsExceeded – The client has hit the max amount of friendships a user can have at a time. For most accounts this limit is set to 1000 but it could be higher for others.

  • InviteeMaxFriendshipsExceeded – The user you attempted to add has hit the max amount of friendships a user can have at a time.

  • InviteeMaxFriendshipRequestsExceeded – The user you attempted to add has hit the max amount of friendship requests a user can have at a time. This is usually 700 total requests.

  • Forbidden – The client is not allowed to send friendship requests to the user because of the users settings.

  • HTTPException – An error occured while requesting to add this friend.

await block_user(user_id)[source]

This function is a coroutine.

Blocks a user by a given user id.

Parameters

user_id (str) – The id of the user you want to block.

Raises

HTTPException – Something went wrong when trying to block this user.

await close(*, close_http=True, dispatch_close=True)[source]

This function is a coroutine.

Logs the user out and closes running services.

Parameters
  • close_http (bool) – Whether or not to close the clients aiohttp.ClientSession when logged out.

  • dispatch_close (bool) – Whether or not to dispatch the close event.

Raises

HTTPException – An error occured while logging out.

event(event_or_coro=None)[source]

A decorator to register an event.

Note

You do not need to decorate events in a subclass of BasicClient but the function names of event handlers must follow this format event_<event>.

Usage:

@client.event
async def event_friend_message(message):
    await message.reply('Thanks for your message!')

@client.event('friend_message')
async def my_message_handler(message):
    await message.reply('Thanks for your message!')
Raises
  • TypeError – The decorated function is not a coroutine.

  • TypeError – Event is not specified as argument or function name with event prefix.

await fetch_active_ltms(region)[source]

This function is a coroutine.

Fetches active LTMs for a specific region.

Parameters

region (Region) – The region to request active LTMs for.

Raises

HTTPException – An error occured while requesting.

Returns

List of internal playlist names. Returns an empty list of none LTMs are for the specified region.

Return type

List[str]

await fetch_avatars(users)[source]

This function is a coroutine.

Fetches the avatars of the provided user ids.

Warning

You can only fetch avatars of friends. That means that the bot has to be friends with the users you are requesting the avatars of.

Parameters

users (List[str]) – A list containing user ids.

Raises

HTTPException – An error occured while requesting.

Returns

A dict containing avatars mapped to their user id.

Return type

Dict[str, Avatar]

await fetch_battlepass_level(user_id, *, season, start_time=None, end_time=None)[source]

This function is a coroutine.

Fetches a users battlepass level.

Parameters
  • user_id (str) – The user id to fetch the battlepass level for.

  • season (int) –

    The season number to request the battlepass level for.

    Warning

    If you are requesting the previous season and the new season has not been added to the library yet (check SeasonStartTimestamp), you have to manually include the previous seasons end timestamp in epoch seconds.

  • start_time (Optional[Union[int, datetime.datetime, SeasonStartTimestamp]]) – The UTC start time of the window to get the battlepass level from. Must be seconds since epoch, :class:`datetime.datetime` or a constant from SeasonEndTimestamp Defaults to None

  • end_time (Optional[Union[int, datetime.datetime, SeasonEndTimestamp]]) – The UTC end time of the window to get the battlepass level from. Must be seconds since epoch, :class:`datetime.datetime` or a constant from SeasonEndTimestamp Defaults to None

Raises
Returns

The users battlepass level. None is returned if the user has not played any real matches this season.

Note

The decimals are the percent progress to the next level. E.g. 208.63 -> Level 208 and 63% on the way to 209.

Return type

Optional[float]

await fetch_blocklist()[source]

This function is a coroutine.

Retrieves the blocklist with an api call.

Raises

HTTPException – An error occured while fetching blocklist.

Returns

List of ids

Return type

List[str]

await fetch_br_news()[source]

This function is a coroutine.

Fetches news for the Battle Royale gamemode.

Raises

HTTPException – An error occured when requesting.

Returns

List[BattleRoyaleNewsPost]

Return type

list

await fetch_br_playlists()[source]

This function is a coroutine.

Fetches all playlists registered on Fortnite. This includes all previous gamemodes that is no longer active.

Raises

HTTPException – An error occured while requesting.

Returns

List containing all playlists registered on Fortnite.

Return type

List[Playlist]

await fetch_br_stats(user_id, *, start_time=None, end_time=None)[source]

This function is a coroutine.

Gets Battle Royale stats the specified user.

Parameters
  • user_id (str) – The id of the user you want to fetch stats for.

  • start_time (Optional[Union[int, datetime.datetime, SeasonStartTimestamp]]) – The UTC start time of the time period to get stats from. Must be seconds since epoch, :class:`datetime.datetime` or a constant from SeasonEndTimestamp Defaults to None

  • end_time (Optional[Union[int, datetime.datetime, SeasonEndTimestamp]]) – The UTC end time of the time period to get stats from. Must be seconds since epoch, :class:`datetime.datetime` or a constant from SeasonEndTimestamp Defaults to None

Raises
  • Forbidden

    The user has chosen to be hidden from public stats by disabling the fortnite setting below. | Settings -> Account and Privacy -> Show on career     leaderboard

  • HTTPException – An error occured while requesting.

Returns

An object representing the stats for this user. If the user was not found None is returned.

Return type

StatsV2

await fetch_item_shop()[source]

This function is a coroutine.

Fetches the current item shop.

Example:

# fetches all CIDs (character ids) of of the current item shop.
async def get_current_item_shop_cids():
    store = await client.fetch_item_shop()

    cids = []
    for item in store.featured_items + store.daily_items:
        for grant in item.grants:
            if grant['type'] == 'AthenaCharacter':
                cids.append(grant['asset'])

    return cids
Raises

HTTPException – An error occured when requesting.

Returns

Object representing the data from the current item shop.

Return type

Store

await fetch_leaderboard(stat)[source]

This function is a coroutine.

Fetches the leaderboard for a stat.

Warning

For some weird reason, the only valid stat you can pass is one with placetop1 (wins is also accepted).

Example usage:

async def get_leaderboard():
    stat = fortnitepy.StatsV2.create_stat(
        'wins',
        fortnitepy.V2Input.KEYBOARDANDMOUSE,
        'defaultsquad'
    )

    data = await client.fetch_leaderboard(stat)

    for placement, entry in enumerate(data):
        print('[{0}] Id: {1} | Wins: {2}'.format(
            placement, entry['account'], entry['value']))
Parameters

stat (str) – The stat you are requesting the leaderboard entries for. You can use StatsV2.create_stat() to create this string.

Raises
  • ValueError – You passed an invalid/non-accepted stat argument.

  • HTTPException – An error occured when requesting.

Returns

List of dictionaries containing entry data. Example return:

{
    'account': '4480a7397f824fe4b407077fb9397fbb',
    'value': 5082
}

Return type

List[Dict[str, Union[str, int]]]

await fetch_lightswitch_status(service_id='Fortnite')[source]

This function is a coroutine.

Fetches the lightswitch status of an epicgames service.

Parameters

service_id (str) – The service id to check status for.

Raises
  • ValueError – The returned data was empty. Most likely because service_id is not valid.

  • HTTPException – An error occured when requesting.

Returns

True if service is up else False

Return type

bool

await fetch_multiple_battlepass_levels(users, season, *, start_time=None, end_time=None)[source]

This function is a coroutine.

Fetches multiple users battlepass level.

Parameters
  • users (List[str]) – List of user ids.

  • season (int) –

    The season number to request the battlepass levels for.

    Warning

    If you are requesting the previous season and the new season has not been added to the library yet (check SeasonStartTimestamp), you have to manually include the previous seasons end timestamp in epoch seconds.

  • start_time (Optional[Union[int, datetime.datetime, SeasonStartTimestamp]]) – The UTC start time of the window to get the battlepass level from. Must be seconds since epoch, :class:`datetime.datetime` or a constant from SeasonEndTimestamp Defaults to None

  • end_time (Optional[Union[int, datetime.datetime, SeasonEndTimestamp]]) – The UTC end time of the window to get the battlepass level from. Must be seconds since epoch, :class:`datetime.datetime` or a constant from SeasonEndTimestamp Defaults to None

Raises

HTTPException – An error occured while requesting.

Returns

Users battlepass level mapped to their account id. Returns None if no battlepass level was found. If a user has career board set to private, he/she will not appear in the result. Therefore you should never expect a user to be included.

Note

The decimals are the percent progress to the next level. E.g. 208.63 -> Level 208 and 63% on the way to 209.

Note

If a users battlepass level is missing in the returned mapping it means that the user has opted out of public leaderboards and that the client therefore does not have permissions to requests their stats.

Return type

Dict[str, Optional[float]]

await fetch_multiple_br_stats(user_ids, stats, *, start_time=None, end_time=None)[source]

This function is a coroutine.

Gets Battle Royale stats for multiple users at the same time.

Note

This function is not the same as doing fetch_br_stats() for multiple users. The expected return for this function would not be all the stats for the specified users but rather the stats you specify.

Example usage:

async def stat_function():
    stats = [
        fortnitepy.StatsV2.create_stat('placetop1', fortnitepy.V2Input.KEYBOARDANDMOUSE, 'defaultsolo'),
        fortnitepy.StatsV2.create_stat('kills', fortnitepy.V2Input.KEYBOARDANDMOUSE, 'defaultsolo'),
        fortnitepy.StatsV2.create_stat('matchesplayed', fortnitepy.V2Input.KEYBOARDANDMOUSE, 'defaultsolo')
    ]

    # get the users and create a list of their ids.
    users = await self.fetch_users(['Ninja', 'DrLupo'])
    user_ids = [u.id for u in users] + ['NonValidUserIdForTesting']

    data = await self.fetch_multiple_br_stats(user_ids=user_ids, stats=stats)
    for id, res in data.items():
        if res is not None:
            print('ID: {0} | Stats: {1}'.format(id, res.get_stats()))
        else:
            print('ID: {0} not found.'.format(id))

# Example output:
# ID: 463ca9d604524ce38071f512baa9cd70 | Stats: {'keyboardmouse': {'defaultsolo': {'wins': 759, 'kills': 28093, 'matchesplayed': 6438}}}
# ID: 3900c5958e4b4553907b2b32e86e03f8 | Stats: {'keyboardmouse': {'defaultsolo': {'wins': 1763, 'kills': 41375, 'matchesplayed': 7944}}}
# ID: 4735ce9132924caf8a5b17789b40f79c | Stats: {'keyboardmouse': {'defaultsolo': {'wins': 1888, 'kills': 40784, 'matchesplayed': 5775}}}
# ID: NonValidUserIdForTesting not found.
Parameters
  • user_ids (List[str]) – A list of ids you are requesting the stats for.

  • stats (List[str]) –

    A list of stats to get for the users. Use StatsV2.create_stat() to create the stats.

    Example:

    [
        fortnitepy.StatsV2.create_stat('placetop1', fortnitepy.V2Input.KEYBOARDANDMOUSE, 'defaultsolo'),
        fortnitepy.StatsV2.create_stat('kills', fortnitepy.V2Input.KEYBOARDANDMOUSE, 'defaultsolo'),
        fortnitepy.StatsV2.create_stat('matchesplayed', fortnitepy.V2Input.KEYBOARDANDMOUSE, 'defaultsolo')
    ]
    

  • start_time (Optional[Union[int, datetime.datetime, SeasonStartTimestamp]]) – The UTC start time of the time period to get stats from. Must be seconds since epoch, :class:`datetime.datetime` or a constant from SeasonEndTimestamp Defaults to None

  • end_time (Optional[Union[int, datetime.datetime, SeasonEndTimestamp]]) – The UTC end time of the time period to get stats from. Must be seconds since epoch, :class:`datetime.datetime` or a constant from SeasonEndTimestamp Defaults to None

Raises

HTTPException – An error occured while requesting.

Returns

A mapping where StatsV2 is bound to its owners id. If a userid was not found then the value bound to that userid will be None.

Note

If a users stats is missing in the returned mapping it means that the user has opted out of public leaderboards and that the client therefore does not have permissions to requests their stats.

Return type

Dict[str, Optional[StatsV2]]

await fetch_multiple_br_stats_collections(user_ids, collection=None, *, start_time=None, end_time=None)[source]

This function is a coroutine.

Gets Battle Royale stats collections for multiple users at the same time.

Parameters
  • user_ids (List[str]) – A list of ids you are requesting the stats for.

  • collection (StatsCollectionType) – The collection to receive. Collections are predefined stats that it attempts to request.

  • start_time (Optional[Union[int, datetime.datetime, SeasonStartTimestamp]]) – The UTC start time of the time period to get stats from. Must be seconds since epoch, :class:`datetime.datetime` or a constant from SeasonEndTimestamp Defaults to None

  • end_time (Optional[Union[int, datetime.datetime, SeasonEndTimestamp]]) – The UTC end time of the time period to get stats from. Must be seconds since epoch, :class:`datetime.datetime` or a constant from SeasonEndTimestamp Defaults to None

Raises

HTTPException – An error occured while requesting.

Returns

A mapping where StatsCollection is bound to its owners id. If a userid was not found then the value bound to that userid will be None.

Note

If a users stats is missing in the returned mapping it means that the user has opted out of public leaderboards and that the client therefore does not have permissions to requests their stats.

Return type

Dict[str, Optional[StatsCollection]]

await fetch_party(party_id)[source]

This function is a coroutine.

Fetches a party by its id.

Parameters

party_id (str) – The id of the party.

Raises

Forbidden – You are not allowed to look up this party.

Returns

The party that was fetched. None if not found.

Return type

Optional[Party]

await fetch_user(user, *, cache=False, raw=False)[source]

This function is a coroutine.

Fetches a single user by the given id/displayname.

Parameters
  • user (str) – Id or display name

  • cache (bool) –

    If set to True it will try to get the user from the friends or user cache and fall back to an api request if not found.

    Note

    Setting this parameter to False will make it an api call.

  • raw (bool) –

    If set to True it will return the data as you would get it from the api request.

    Note

    Setting raw to True does not work with cache set to True.

Raises

HTTPException – An error occured while requesting the user.

Returns

The user requested. If not found it will return None

Return type

Optional[User]

await fetch_user_by_display_name(display_name, *, cache=False, raw=False)[source]

This function is a coroutine.

Fetches a user from the passed display name.

Parameters
  • display_name (str) – The display name of the user you want to fetch the user for.

  • cache (bool) –

    If set to True it will try to get the user from the friends or user cache.

    Note

    Setting this parameter to False will make it an api call.

  • raw (bool) –

    If set to True it will return the data as you would get it from the api request.

    Note

    Setting raw to True does not work with cache set to True.

Raises

HTTPException – An error occured while requesting the user.

Returns

The user requested. If not found it will return None.

Return type

Optional[User]

await fetch_user_by_email(email, *, cache=False, raw=False)[source]

This function is a coroutine.

Fetches a single user by the email.

Warning

Because of epicgames throttling policy, you can only do this request three times in a timespan of 600 seconds. If you were to do more than three requests in that timespan, a HTTPException would be raised.

Parameters
  • email (str) – The email of the account you are requesting.

  • cache (bool) –

    If set to True it will try to get the user from the friends or user cache and fall back to an api request if not found.

    Note

    This method does two api requests but with this set to False only one request will be done as long as the user is found in one of the caches.

  • raw (bool) –

    If set to True it will return the data as you would get it from the api request.

    Note

    Setting raw to True does not work with cache set to True.

Raises

HTTPException – An error occured while requesting the user.

Returns

The user requested. If not found it will return None

Return type

Optional[User]

await fetch_users(users, *, cache=False, raw=False)[source]

This function is a coroutine.

Fetches multiple users at once by the given ids/displaynames.

Parameters
  • users (Iterable[str]) – An iterable containing ids/displaynames.

  • cache (bool) –

    If set to True it will try to get the users from the friends or user cache and fall back to an api request if not found.

    Note

    Setting this parameter to False will make it an api call.

  • raw (bool) –

    If set to True it will return the data as you would get it from the api request.

    Note

    Setting raw to True does not work with cache set to True.

Raises

HTTPException – An error occured while requesting user information.

Returns

Users requested. Only users that are found gets returned.

Return type

List[User]

await fetch_users_by_display_name(display_name, *, raw=False)[source]

This function is a coroutine.

Fetches all users including external users (accounts from other platforms) that matches the given the display name.

Warning

This function is not for requesting multiple users by multiple display names. Use BasicClient.fetch_user() for that.

Parameters
  • display_name (str) – The display name of the users you want to get.

  • raw (bool) – If set to True it will return the data as you would get it from the api request. Defaults to ``False``

Raises

HTTPException – An error occured while requesting the user.

Returns

A list containing all payloads found for this user.

Return type

List[User]

is_closed()[source]

bool: Whether the client is running or not.

is_ready()[source]

Specifies if the internal state of the client is ready.

Returns

True if the internal state is ready else False

Return type

bool

await join_party(party_id)[source]

This function is a coroutine.

Joins a party by the party id.

Parameters

party_id (str) – The id of the party you wish to join.

Raises
  • . warning:: – Because the client has to leave its current party before joining a new one, a new party is created if some of these errors are raised. Most of the time though this is not the case and the client will remain in its current party.

  • PartyError – You are already a member of this party.

  • NotFound – The party was not found.

  • PartyIsFull – The party you attempted to join is full.

  • Forbidden – You are not allowed to join this party because it’s private and you have not been a part of it before. .. note:: If you have been a part of the party before but got kicked, you are ineligible to join this party and this error is raised.

  • HTTPException – An error occurred when requesting to join the party.

Returns

The party that was just joined.

Return type

ClientParty

remove_event_handler(event, coro)[source]

Removes a coroutine as an event handler.

Parameters
  • event (str) – The name of the event you want to remove this coro for.

  • coro (coroutine) – The coroutine that already functions as a handler for the specified event.

await remove_or_decline_friend(user_id)[source]

This function is a coroutine.

Removes a friend by the given id.

Parameters

user_id (str) – The id of the friend you want to remove.

Raises

HTTPException – Something went wrong when trying to remove this friend.

await restart()[source]

This function is a coroutine.

Restarts the client completely. All events received while this method runs are dispatched when it has finished.

Raises
  • AuthException – Raised if invalid credentials in any form was passed or some other misc failure.

  • HTTPException – A request error occured while logging in.

run()[source]

This function starts the loop and then calls start() for you. If your program already has an asyncio loop setup, you should use start() instead.

Warning

This function is blocking and should be the last function to run.

Raises
  • AuthException – Raised if invalid credentials in any form was passed or some other misc failure.

  • HTTPException – A request error occured while logging in.

await search_sac_by_slug(slug)[source]

This function is a coroutine.

Searches for an owner of slug + retrieves owners of similar slugs.

Parameters

slug (str) – The slug (support a creator code) you wish to search for.

Raises

HTTPException – An error occured while requesting fortnite’s services.

Returns

An ordered list of users who matched the exact or slightly modified slug.

Return type

List[SacSearchEntryUser]

await search_users(prefix, platform)[source]

This function is a coroutine.

Searches after users by a prefix and returns up to 100 matches.

Parameters
  • prefix (str) –

    The prefix you want to search by. The prefix is case insensitive.
    Example: Tfue will return Tfue’s user + up to 99 other

    users which have display names that start with or match exactly to Tfue like Tfue_Faze dequan.

  • platform (UserSearchPlatform) –

    The platform you wish to search by.

    Note

    The platform is only important for prefix matches. All exact matches are returned regardless of which platform is specified.

Raises

HTTPException – An error occured while requesting.

Returns

An ordered list of users that matched the prefix.

Return type

List[UserSearchEntry]

start(dispatch_ready=True)[source]

This function is a coroutine.

Starts the client and logs into the specified user.

This method can be used as a coroutine or an async context manager, depending on your needs.

How to use as an async context manager: ::
async with client.start():

user = await client.fetch_user(‘Ninja’) print(user.display_name)

If you want to use it as an async context manager, but also keep the client running forever, you can await the return of start like this:

async with client.start() as future:
    user = await client.fetch_user('Ninja')
    print(user.display_name)

    await future  # Nothing after this line will run.

Warning

This method is blocking if you await it as a coroutine or you await the return future. This means that no code coming after will run until the client is closed. When the client is ready it will dispatch event_ready().

Parameters

dispatch_ready (bool) – Whether or not the client should dispatch the ready event when ready.

Raises
  • AuthException – Raised if invalid credentials in any form was passed or some other misc failure.

  • HTTPException – A request error occured while logging in.

await unblock_user(user_id)[source]

This function is a coroutine.

Unblocks a user by a given user id.

Parameters

user_id (str) – The id of the user you want to unblock

Raises

HTTPException – Something went wrong when trying to unblock this user.

wait_for(event, *, check=None, timeout=None)[source]

This function is a coroutine.

Waits for an event to be dispatch.

In case the event returns more than one arguments, a tuple is passed containing the arguments.

Examples

This example waits for the author of a FriendMessage to say hello.:

@client.event
async def event_friend_message(message):
    await message.reply('Say hello!')

    def check_function(m):
        return m.author.id == message.author.id

    msg = await client.wait_for('message', check=check_function, timeout=60)
    await msg.reply('Hello {0.author.display_name}!'.format(msg))

This example waits for the the leader of a party to promote the bot after joining and then sets a new custom key:

@client.event
async def event_party_member_join(member):

    # checks if the member that joined is the UserClient
    if member.id != client.user.id:
        return

    def check(m):
        return m.id == client.user.id

    try:
        await client.wait_for('party_member_promote', check=check, timeout=120)
    except asyncio.TimeoutError:
        await member.party.send('You took too long to promote me!')

    await member.party.set_custom_key('my_custom_key_123')
Parameters
  • event (str) –

    The name of the event.

    Note

    The name of the event must be without the event_

    prefix. | | Wrong = event_friend_message. | Correct = friend_message.

  • check (Optional[Callable]) – A predicate to check what to wait for. Defaults to a predicate that always returns True. This means it will return the first result unless you pass another predicate.

  • timeout (int) – How many seconds to wait for before asyncio.TimeoutError is raised. Defaults to ``None`` which means it will wait forever.

Raises

asyncio.TimeoutError – No event was retrieved in the time you specified.

Returns

Returns arguments based on the event you are waiting for. An event might return no arguments, one argument or a tuple of arguments. Check the event reference <fortnitepy-events-api> for more information about the returning arguments.

Return type

Any

await wait_until_closed()[source]

This function is a coroutine.

Waits until the client is fully closed.

await wait_until_ready()[source]

This function is a coroutine.

Waits until the internal state of the client is ready.

set_presence(status, *, away=<AwayStatus.ONLINE: None>)[source]

This function is a coroutine.

Sends and sets the status. This status message will override all other presence statuses including party presence status.

Parameters
Raises

TypeError – The status you tried to set were not a str.

await send_presence(status, *, away=<AwayStatus.ONLINE: None>, to=None)[source]

This function is a coroutine.

Sends this status to all or one single friend.

Parameters
  • status (Union[str, dict]) – The status message in str or full status in dict.

  • away (AwayStatus) – The away status to use. Defaults to AwayStatus.ONLINE.

  • to (Optional[aioxmpp.JID]) – The JID of the user that should receive this status. Defaults to None which means it will send to all friends.

Raises

TypeError – Status was an invalid type.

await set_platform(platform)[source]

This function is a coroutine.

Sets and updates the clients platform. This method is slow (~2-3s) as changing platform requires a full authentication refresh.

Parameters

platform (Platform) – The platform to set.

Raises

HTTPException – An error occurred when requesting.

Utility Functions

Utility functions provided by the package.

fortnitepy.run_multiple(clients, *, gap_timeout=0.2, shutdown_on_error=True, ready_callback=None, error_callback=None, all_ready_callback=None, before_start=None, before_close=None)[source]

This function sets up a loop and then calls start_multiple() for you. If you already have a running event loop, you should start the clients with start_multiple(). On shutdown, all clients will be closed gracefully.

Warning

This function is blocking and should be the last function to run.

Parameters
  • clients (List[BasicClient]) – A list of the clients you wish to start.

  • gap_timeout (float) – The time to sleep between starting clients. Defaults to 0.2.

  • shutdown_on_error (bool) – If the function should cancel all other start tasks if one of the tasks fails. You can catch the error by try excepting.

  • ready_callback (Optional[Union[Callable[BasicClient], Awaitable[BasicClient]]]) – A callable/async callback taking a single parameter client. The callback is called whenever a client is ready.

  • error_callback (Optional[Union[Callable[BasicClient, Exception], Awaitable[BasicClient, Exception]]]) – A callable/async callback taking two parameters, BasicClient and an exception. The callback is called whenever a client fails logging in. The callback is not called if shutdown_on_error is True.

  • all_ready_callback (Optional[Union[Callable, Awaitable]]) – A callback/async callback that is called whenever all clients have finished logging in, regardless if one of the clients failed logging in. That means that the callback is always called when all clients are either logged in or raised an error.

  • before_start (Optional[Awaitable]) – An async callback that is called when just before the clients are beginning to start. This must be a coroutine as all the clients wait to start until this callback is finished processing so you can do heavy start stuff like opening database connections, sessions etc.

  • before_close (Optional[Awaitable]) – An async callback that is called when the clients are beginning to close. This must be a coroutine as all the clients wait to close until this callback is finished processing so you can do heavy close stuff like closing database connections, sessions etc.

Raises
  • AuthException – Raised if invalid credentials in any form was passed or some other misc failure.

  • HTTPException – A request error occured while logging in.

await fortnitepy.start_multiple(clients, *, gap_timeout=0.2, shutdown_on_error=True, ready_callback=None, error_callback=None, all_ready_callback=None, before_start=None, before_close=None)[source]

This function is a coroutine.

Starts multiple clients at the same time.

Warning

This function is blocking and should be the last function to run.

Parameters
  • clients (List[BasicClient]) – A list of the clients you wish to start.

  • gap_timeout (float) – The time to sleep between starting clients. Defaults to 0.2.

  • shutdown_on_error (bool) – If the function should cancel all other start tasks if one of the tasks fails. You can catch the error by try excepting.

  • ready_callback (Optional[Union[Callable[BasicClient], Awaitable[BasicClient]]]) – A callable/async callback taking a single parameter client. The callback is called whenever a client is ready.

  • error_callback (Optional[Union[Callable[BasicClient, Exception], Awaitable[BasicClient, Exception]]]) – A callable/async callback taking two parameters, BasicClient and an exception. The callback is called whenever a client fails logging in. The callback is not called if shutdown_on_error is True.

  • all_ready_callback (Optional[Union[Callable, Awaitable]]) – A callback/async callback that is called whenever all clients have finished logging in, regardless if one of the clients failed logging in. That means that the callback is always called when all clients are either logged in or raised an error.

  • before_start (Optional[Awaitable]) – An async callback that is called when just before the clients are beginning to start. This must be a coroutine as all the clients wait to start until this callback is finished processing so you can do heavy start stuff like opening database connections, sessions etc.

  • before_close (Optional[Awaitable]) – An async callback that is called when the clients are beginning to close. This must be a coroutine as all the clients wait to close until this callback is finished processing so you can do heavy close stuff like closing database connections, sessions etc.

Raises
  • AuthException – Raised if invalid credentials in any form was passed or some other misc failure.

  • ValueError – Two or more clients with the same authentication identifier was passed. This means that you attemted to start two or more clients with the same credentials.

  • HTTPException – A request error occured while logging in.

await fortnitepy.close_multiple(clients)[source]

This function is a coroutine.

Closes multiple clients at the same time by calling BasicClient.close() on all of them.

Parameters

clients (Iterable[BasicClient]) – An iterable of the clients you wish to close. If a client is already closing or closed, it will get skipped without raising an error.

Enumerations

class fortnitepy.PartyPrivacy[source]

Specifies the privacy used in parties created by the client.

PUBLIC

Sets privacy to completely public. This means everyone can join the party, even friends of friends.

FRIENDS_ALLOW_FRIENDS_OF_FRIENDS

Sets privacy to only allow friends but friends of friends are able to join.

FRIENDS

Sets privacy to friends only.

PRIVATE_ALLOW_FRIENDS_OF_FRIENDS

Sets privacy to private but allows friends of friends.

PRIVATE

Sets privacy to private without the possibility of friends of friends joining.

class fortnitepy.V2Input[source]

An enumeration for valid input types used for stats.

KEYBOARDANDMOUSE

Input type used for all users of keyboard and mouse. This is not only used for pc players but also other platforms where it’s possible to use keyboard and mouse.

GAMEPAD

Input type used for all players using a gamepad/controller. This is not only used for console players but also other platforms where it’s possible to use a gamepad/controller.

TOUCH

Input type used for all players using a touch display as controls. This is not only used for mobile players but also other platforms where it’s possible to use a touch display as controls.

class fortnitepy.Region[source]

An enumeration for all currently available Fortnite regions.

NAEAST

The North America East region.

NAWEST

The North America West region.

EUROPE

The Europe region.

BRAZIL

The Brazil region.

OCEANIA

The Oceania region.

ASIA

The Asia region.

MIDDLEEAST

The Middle East region.

class fortnitepy.Platform[source]

An enumeration for all currently available platforms.

WINDOWS
MAC
PLAYSTATION_4

Also accessible under PLAYSTATION for legacy reasons.

PLAYSTATION_5
XBOX_ONE

Also accessible under XBOX for legacy reasons.

XBOX_X
SWITCH
IOS
ANDROID
class fortnitepy.ReadyState[source]

An enumeration for the available ready states.

READY
NOT_READY
SITTING_OUT
class fortnitepy.UserSearchPlatform[source]
EPIC_GAMES

This represents all platforms that use epic games as account service like PC and Mobile.

PLAYSTATION
XBOX
STEAM
class fortnitepy.ProfileSearchMatchType
EXACT

The prefix matched the display name perfectly.

PREFIX

The prefix matched the start of the display name perfectly.

class fortnitepy.AwayStatus[source]
ONLINE

User is currently active.

AWAY

User has set his status to away in-game

EXTENDED_AWAY

User is AFK. This can only be applied by the game and it is set after a specific time of no activity.

class fortnitepy.SeasonStartTimestamp[source]

An enumeration of season start dates.

SEASON_1
SEASON_2
SEASON_3
SEASON_4
SEASON_5
SEASON_6
SEASON_7
SEASON_8
SEASON_9
SEASON_10
SEASON_11
SEASON_12
class fortnitepy.SeasonEndTimestamp[source]

An enumeration of season end dates.

SEASON_1
SEASON_2
SEASON_3
SEASON_4
SEASON_5
SEASON_6
SEASON_7
SEASON_8
SEASON_9
SEASON_10
SEASON_11
class fortnitepy.StatsCollectionType[source]

An enumeration for stats collection types.

FISH

Event Reference

Events can be registered by the @client.event decorator. You do not need this decorator if you are in a subclass of Client.

Warning

All events must be registered as coroutines!

fortnitepy.event_ready()

This event is called when the client .has been successfully established and connected to all services.

Note

This event is not called when the client starts in Client.close().

fortnitepy.event_before_start()

This event is called and waited for before the client starts.

Warning

This event is not called when the client starts in Client.restart().

Note

This event behaves differently from the other events. The client will wait until the event handlers for this event is finished processing before actually closing. This makes it so you are able to do heavy and/or time consuming operations before the client fully logs out. This unfortunately also means that this event is not compatible with Client.wait_for().

fortnitepy.event_before_close()

This event is called when the client is beginning to log out. This event also exists under the name event_close() for legacy reasons.

Warning

This event is not called when the client logs out in Client.restart().

Note

This event behaves differently from the other events. The client will wait until the event handlers for this event is finished processing before actually closing. This makes it so you are able to do heavy and/or time consuming operations before the client fully logs out. This unfortunately also means that this event is not compatible with Client.wait_for().

fortnitepy.event_restart()

This event is called when the client has successfully restarted.

fortnitepy.event_xmpp_session_establish()

Called whenever a xmpp session has been established. This can be called multiple times.

fortnitepy.event_xmpp_session_lost()

Called whenever the xmpp connection is lost. This can happen when the internet connection is lost or if epics services goes down.

fortnitepy.event_xmpp_session_close()

Called whenever the xmpp connection is closed. This means that it is called both when it’s lost or closed gracefully.

fortnitepy.event_device_auth_generate(details, email)

This event is called whenever new device authentication details are generated.

Parameters
  • details (dict) – A dictionary containing the keys device_id, account_id and secret.

  • email (str) – Email of the account that just generated new device auth details.

fortnitepy.event_auth_refresh()

This event is called when the clients authentication has been refreshed.

fortnitepy.event_friend_message(message)

This event is called when ClientUser receives a private message.

Parameters

message (FriendMessage) – Message object.

fortnitepy.event_party_message(message)

This event is called when ClientUser’s party receives a message.

Parameters

message (PartyMessage) – Message object.

fortnitepy.event_friend_add(friend)

This event is called when a friend has been added.

Note

This event is called regardless of the direction. That means it will get called even if the client were to be the one to accept the user.

Parameters

friend (Friend) – Friend that has been added.

fortnitepy.event_friend_remove(friend)

This event is called when a friend has been removed from the friendlist.

Note

This event is called regardless of the direction. That means it will get called even if the client were to be the one to remove the friend.

Parameters

friend (Friend) – Friend that was removed.

fortnitepy.event_friend_request(request)

This event is called when the client receives a friend request.

Parameters

request (Union[IncomingPendingFriend, OutgoingPendingFriend]) – Request object.

fortnitepy.event_friend_request_decline(friend)

This event is called when a friend request is declined.

Parameters

request (Union[IncomingPendingFriend, OutgoingPendingFriend]) – Request object.

fortnitepy.event_friend_request_abort(friend)

This event is called when a friend request is aborted. Aborted means that the friend request was deleted before the receiving user managed to accept it.

Parameters

request (Union[IncomingPendingFriend, OutgoingPendingFriend]) – Request object.

fortnitepy.event_friend_presence(before, after)

This event is called when the client receives a presence from a friend. Presence is received when a user logs into fortnite, closes fortnite or when an user does an action when logged in e.g. joins into a game or joins a party.

Parameters
  • before (Optional[Presence]) – The previously received presence object. Can be None usually because the friend was previously offline or because the client just started and therefore no presence had been already stored in the presence cache.

  • after (Presence) – The new presence object.

fortnitepy.event_party_invite(invitation)

This event is called when a party invitation is received.

Parameters

invitation (ReceivedPartyInvitation) – Invitation object.

fortnitepy.event_invalid_party_invite(friend)

This event is called whenever you received an invite that was invalid. Usually this is because the invite was from a private party you have been kicked from.

Parameters

friend (Friend) – The friend that invited you.

fortnitepy.event_party_member_promote(old_leader, new_leader)

This event is called when a new partyleader has been promoted.

Parameters
  • old_leader (PartyMember) – Member that was previously leader.

  • new_leader (PartyMember) – Member that was promoted.

fortnitepy.event_party_member_kick(member)

This event is called when a member has been kicked from the party.

Parameters

member (PartyMember) – The member that was kicked.

fortnitepy.event_party_member_zombie(member)

This event is called when a members connection was lost and therefore entered a zombie state waiting for their offline time to live expires. If the connection is restored before timing out, event_party_member_reconnect() is called. If not then event_party_member_expire() is called when their time to live runs out.

Parameters

member (PartyMember) – The member that lost its connection.

fortnitepy.event_party_member_reconnect(member)

This event is called when a member reconnects after losing their connection.

Parameters

member (PartyMember) – The member that reconnected.

fortnitepy.event_party_member_expire(member)

This event is called when a member expires after being in their zombie state for 30 seconds.

Parameters

member (PartyMember) – The member that expired.

fortnitepy.event_party_update(party)

This event is called when ClientUser’s partymeta is updated. An example of when this is called is when a new custom key has been set.

Parameters

party (Party) – The party that was updated.

fortnitepy.event_party_member_update(member)

This event is called when the meta of a member of ClientUser’s party is updated. An example of when this might get called is when a member changes outfit.

Parameters

member (PartyMember) – The member whos meta was updated.

fortnitepy.event_party_member_join(member)

This event is called when a new member has joined ClientUser’s party.

Parameters

member (PartyMember) – The member who joined.

fortnitepy.event_party_member_leave(member)

This event is called when a member leaves the party.

Parameters

member (PartyMember) – The member who left the party.

fortnitepy.event_party_member_confirm(confirmation)

This event is called when a member asks to join the party.

Warning

This event is automatically handled by the client which automatically always accepts the user. If you have this event referenced in your code the client won’t automatically handle it anymore and you must handle it youself.

Note

This event differs from event_party_join_request() by the fact that this event is fired whenever someone is in the middle of joining the party, while event_party_join_request() is called when someone explicitly requests to join your private party.

Parameters

confirmation (PartyJoinConfirmation) – Confirmation object with accessible confirmation methods.

fortnitepy.event_party_join_request(request)

This event is called when a friend requests to join your private party.

Note

This event differs from event_party_member_confirm() by the fact that this event is called when someone explicitly requests to join the bots party, while event_party_member_confirm() is an event that is fired whenever someone is in the middle of joining the party.

Parameters

request (PartyJoinRequest) – Request object.

fortnitepy.event_party_member_chatban(member, reason)

This event is called whenever a member of the party has been banned from the party chat.

Parameters
  • member (PartyMember) – The member that was banned.

  • reason (Optional[str]) – The reason for the ban if available.

fortnitepy.event_party_invite_cancel()

This event is called when an invite has been cancelled.

fortnitepy.event_party_invite_decline()

This event is called when an invite has been declined.

fortnitepy.event_party_playlist_change(party, before, after)

This event is called when the playlist data has been changed.

Parameters
  • party (ClientParty) – The party that changed.

  • before (tuple) – The previous playlist data. Same structure as .

  • after (tuple) – The current playlist data. Same structure as .

fortnitepy.event_party_squad_fill_change(party, before, after)

This event is called when squad fill has been changed.

Parameters
  • party (ClientParty) – The party that changed.

  • before (bool) – The previous squad fill value.

  • after (bool) – The current squad fill value.

fortnitepy.event_party_privacy_change(party, before, after)

This event is called when the party privacy has been changed.

Parameters
  • party (ClientParty) – The party that changed.

  • before (Privacy) – The previous party privacy.

  • after (Privacy) – The current party privacy.

fortnitepy.event_party_member_team_swap(member, other)

Note

Because of how party teams work, you can swap team with another member without their permission. If you don’t want this to be possible, you can set team_change_allowed to False in DefaultPartyConfig.

This event is called whenever a party member swaps their position. If the member switches to a position that was taken my another member, the two members will swap positions. You can get their new positions from PartyMember.position.

Parameters
  • member (PartyMember) – The member that instigated the team swap.

  • other (Optional[PartyMember]) – The member that was swapped teams with. If no member was previously holding the position, this will be None.

fortnitepy.event_party_member_ready_change(member, before, after)

This event is called when a members ready state has changed.

Parameters
fortnitepy.event_party_member_input_change(member, before, after)

This event is called when a members input has been changed.

Parameters
  • member (PartyMember) – The member that changed.

  • before (str) – The previous input.

  • after (str) – The current input.

fortnitepy.event_party_member_assisted_challenge_change(member, before, after)

This event is called when a members assisted challenge has been changed.

Parameters
  • member (PartyMember) – The member that changed.

  • before (str) – The previous assisted challenge. None if no assisted challenge was previously set.

  • after (str) – The current assisted challenge. None if the assisted challenge was removed.

fortnitepy.event_party_member_outfit_change(member, before, after)

This event is called when a members outfit has been changed.

Parameters
  • member (PartyMember) – The member that changed.

  • before (str) – The previous outfit cid.

  • after (str) – The current outfit cid.

fortnitepy.event_party_member_backpack_change(member, before, after)

This event is called when a members backpack has been changed.

Parameters
  • member (PartyMember) – The member that changed.

  • before (str) – The previous backpack bid.

  • after (str) – The current backpack bid.

fortnitepy.event_party_member_pet_change(member, before, after)

This event is called when a members pet has been changed.

Parameters
  • member (PartyMember) – The member that changed.

  • before (str) – The previous pet id.

  • after (str) – The current pet id.

fortnitepy.event_party_member_pickaxe_change(member, before, after)

This event is called when a members pickaxe has been changed.

Parameters
  • member (PartyMember) – The member that changed.

  • before (str) – The previous pickaxe pid.

  • after (str) – The current pickaxe pid.

fortnitepy.event_party_member_contrail_change(member, before, after)

This event is called when a members contrail has been changed.

Parameters
  • member (PartyMember) – The member that changed.

  • before (str) – The previous contrail id.

  • after (str) – The current contrail id.

fortnitepy.event_party_member_emote_change(member, before, after)

This event is called when a members emote has been changed.

Parameters
  • member (PartyMember) – The member that changed.

  • before (str) – The previous emote eid. None if no emote was currently playing.

  • after (str) – The current emote eid. None if the emote was stopped.

fortnitepy.event_party_member_emoji_change(member, before, after)

This event is called when a members emoji has been changed.

Parameters
  • member (PartyMember) – The member that changed.

  • before (str) – The previous emoji id. None if no emoji was currently playing.

  • after (str) – The current emoji id. None if the emoji was stopped.

fortnitepy.event_party_member_banner_change(member, before, after)

This event is called when a members banner has been changed.

Parameters
fortnitepy.event_party_member_battlepass_info_change(member, before, after)

This event is called when a members battlepass info has been changed.

Parameters
fortnitepy.event_party_member_enlightenments_change(member, before, after)

This event is called when a members enlightenments values are changed.

Parameters
  • member (PartyMember) – The member that changed.

  • before (list) – The previous enlightenment values.

  • after (list) – The current enlightenment values.

fortnitepy.event_party_member_corruption_change(member, before, after)

This event is called when a members corruption value is changed.

Parameters
  • member (PartyMember) – The member that changed.

  • before (Optional[list]) – The previous corruption value. Could be None if not set.

  • after (Optional[list]) – The current corruption value. Could be None if not set.

fortnitepy.event_party_member_outfit_variants_change(member, before, after)

This event is called when a members outfit variants been changed.

Parameters
fortnitepy.event_party_member_backpack_variants_change(member, before, after)

This event is called when a members backpack variants been changed.

Parameters
fortnitepy.event_party_member_pickaxe_variants_change(member, before, after)

This event is called when a members pickaxe variants been changed.

Parameters
fortnitepy.event_party_member_contrail_variants_change(member, before, after)

This event is called when a members contrail variants been changed.

Parameters
fortnitepy.event_party_member_in_match_change(member, before, after)

This event is called when a member join or leaves a match.

Parameters
  • member (PartyMember) – The member that changed.

  • before (bool) – The previous match state.

  • after (bool) – The new and current match state.

fortnitepy.event_party_member_match_players_left_change(member, before, after)

This event is called when the servercount changes in the match the member is currently in.

Parameters
  • member (PartyMember) – The member that changed.

  • before (int) – The previous servercount.

  • after (int) – The new and current servercount.

fortnitepy.event_party_member_lobby_map_marker_is_visible_change(member, before, after)

This event is called when the visibility of a members lobby map marker is toggled.

Parameters
  • member (PartyMember) – The member that changed.

  • before (bool) – Whether or not the marker used to be visible.

  • after (bool) – Whether or not the marker is now currently visible.

fortnitepy.event_party_member_lobby_map_marker_coordinates_change(member, before, after)

This event is called when the coordinates of a members lobby map marker is changed.

Parameters
  • member (PartyMember) – The member that changed.

  • before (Tuple[float, class:float]) – The previous coordinates.

  • after (Tuple[float, class:float]) – The new coordinates.

Stats Reference

Gamemode names

Since stats received from Fortnite’s services changes all the time by adding new gamemodes and such, none of the gamemode names have been changed from the original response gotten from the request. Therefore, if you want to access a users solo stats, you must use the internal name for the solo gamemode: defaultsolo.

There is no good, easy way of retrieving all these internal names. So for now the best way you can do this is by fetching stats from someone that has played a lot of different gamemode e.g. the user Dark (more known as Dakotaz) and just write the gamemode names down.

Stats

Default Solos Gamemode (defaultsolo)

{
  'wins': int,
  'placetop10': int,
  'placetop25': int,
  'kills': int,
  'score': int,
  'playersoutlives': int,
  'minutesplayed': int,
  'matchesplayed': int,
  'lastmodified': datetime.datetime,
}

Default Duos Gamemode (defaultduo)

{
  'wins': int,
  'placetop5': int,
  'placetop12': int,
  'kills': int,
  'score': int,
  'playersoutlives': int,
  'minutesplayed': int,
  'matchesplayed': int,
  'lastmodified': datetime.datetime,
}

Default Trios Gamemode (trios)

{
  'wins': int,
  'kills': int,
  'score': int,
  'playersoutlives': int,
  'minutesplayed': int,
  'matchesplayed': int,
  'lastmodified': datetime.datetime,
}

Default Squads Gamemode (defaultsquad)

{
  'wins': int,
  'placetop3': int,
  'placetop6': int,
  'kills': int,
  'score': int,
  'playersoutlives': int,
  'minutesplayed': int,
  'matchesplayed': int,
  'lastmodified': datetime.datetime,
}

Fortnite Models

Danger

The classes below should never be created by users. These are classed representing data received from fortnite’s services.

ClientUser

class fortnitepy.ClientUser[source]

Represents the user the client is connected to.

client

The client.

Type

BasicClient

age_group

The age group of the user.

Type

str

can_update_display_name

True if the user can update it’s displayname else False

Type

bool

country

The country the user wasregistered in.

Type

str

email

The email of the user.

Type

str

failed_login_attempts

Failed login attempts

Type

str

headless

True if the account has no display name due to no epicgames account being linked to the current account.

Type

bool

last_login

UTC time of the last login of the user. None if no failed login attempt has been registered.

Type

datetime.datetime

name

First name of the user.

Type

str

first_name

First name of the user. Alias for name.

Type

str

last_name

Last name of the user.

Type

str

full_name

Full name of the user.

Type

str

number_of_display_name_changes

Amount of displayname changes.

Type

int

preferred_language

Users preferred language.

Type

str

tfa_enabled

True if the user has two-factor authentication enabled else False.

Type

bool

email_verified

True if the accounts email has been verified.

Type

bool

minor_verified

True if the account has been verified to be run by a minor.

Type

bool

minor_expected

True if the account is expected to be run by a minor.

Type

bool

minor_status

The minor status of this account.

Type

str

jid

The JID of the client. Includes the resource part.

Type

aioxmpp.JID

display_name

The users displayname

Warning

The display name will be the one registered to the epicgames account. If an epicgames account is not found it defaults to the display name of an external auth.

Warning

This property might be None if Client.fetch_user_data_in_events is set to False.

Type

Optional[str]

epicgames_account

Tells you if the user is an account registered to epicgames services. False if the user is from another platform without having linked their account to an epicgames account.

Warning

If this is True, the display name will be the one registered to the epicgames account, if not it defaults to the display name of an external auth.

Warning

This property might be False even though the account is a registered epic games account if Client.fetch_user_data_in_events is set to False.

Type

bool

external_auths

List containing information about external auths. Might be empty if the user does not have any external auths.

Type

List[ExternalAuth]

await fetch()[source]

This function is a coroutine.

Fetches basic information about this user and sets the updated properties. This might be useful if you for example need to be sure the display name is updated or if you have Client.fetch_user_data_in_events set to False.

Raises

HTTPException – An error occured while requesting.

await fetch_battlepass_level(*, season, start_time=None, end_time=None)[source]

This function is a coroutine.

Fetches this users battlepass level.

Parameters
  • season (int) –

    The season number to request the battlepass level for.

    Warning

    If you are requesting the previous season and the new season has not been added to the library yet (check SeasonStartTimestamp), you have to manually include the previous seasons end timestamp in epoch seconds.

  • start_time (Optional[Union[int, datetime.datetime, SeasonStartTimestamp]]) – The UTC start time of the window to get the battlepass level from. Must be seconds since epoch, :class:`datetime.datetime` or a constant from SeasonEndTimestamp Defaults to None

  • end_time (Optional[Union[int, datetime.datetime, SeasonEndTimestamp]]) – The UTC end time of the window to get the battlepass level from. Must be seconds since epoch, :class:`datetime.datetime` or a constant from SeasonEndTimestamp Defaults to None

Raises

HTTPException – An error occured while requesting.

Returns

The users battlepass level. None is returned if the user has not played any real matches this season.

Note

The decimals are the percent progress to the next level. E.g. 208.63 -> Level 208 and 63% on the way to 209.

Return type

Optional[float]

await fetch_br_stats(*, start_time=None, end_time=None)[source]

This function is a coroutine.

Fetches this users stats.

Parameters
  • start_time (Optional[Union[int, datetime.datetime, SeasonStartTimestamp]]) – The UTC start time of the time period to get stats from. Must be seconds since epoch, :class:`datetime.datetime` or a constant from SeasonEndTimestamp Defaults to None

  • end_time (Optional[Union[int, datetime.datetime, SeasonEndTimestamp]]) – The UTC end time of the time period to get stats from. Must be seconds since epoch, :class:`datetime.datetime` or a constant from SeasonEndTimestamp Defaults to None

Raises
  • Forbidden – The user has chosen to be hidden from public stats by disabling the fortnite setting below. Settings -> Account and Privacy -> Show on career     leaderboard

  • HTTPException – An error occured while requesting.

Returns

An object representing the stats for this user.

Return type

StatsV2

await fetch_br_stats_collection(collection, start_time=None, end_time=None)[source]

This function is a coroutine.

Fetches a stats collections for this user.

Parameters
  • start_time (Optional[Union[int, datetime.datetime, SeasonStartTimestamp]]) – The UTC start time of the time period to get stats from. Must be seconds since epoch, :class:`datetime.datetime` or a constant from SeasonEndTimestamp Defaults to None

  • end_time (Optional[Union[int, datetime.datetime, SeasonEndTimestamp]]) – The UTC end time of the time period to get stats from. Must be seconds since epoch, :class:`datetime.datetime` or a constant from SeasonEndTimestamp Defaults to None

Raises
  • Forbidden – The user has chosen to be hidden from public stats by disabling the fortnite setting below. Settings -> Account and Privacy -> Show on career     leaderboard

  • HTTPException – An error occured while requesting.

Returns

An object representing the stats collection for this user.

Return type

StatsCollection

id

The users id

Type

str

ExternalAuth

class fortnitepy.ExternalAuth[source]

Represents an external auth belonging to a user.

client

The client.

Type

BasicClient

type

The type/platform of the external auth.

Type

str:

id

The users universal fortnite id.

Type

str:

external_id

The id belonging to this user on the platform. This could in some cases be None.

Type

Optional[str]

external_display_name

The display name belonging to this user on the platform. This could in some cases be None.

Type

Optional[str]

extra_info

Extra info from the payload. Usually empty on accounts other than ClientUser.

Type

Dict[str, Any]

User

class fortnitepy.User[source]

Represents a user from Fortnite

await block()[source]

This function is a coroutine.

Blocks this user.

Raises

HTTPException – Something went wrong while blocking this user.

await add()[source]

This function is a coroutine.

Sends a friendship request to this user or adds them if they have already sent one to the client.

Raises
  • NotFound – The specified user does not exist.

  • DuplicateFriendship – The client is already friends with this user.

  • FriendshipRequestAlreadySent – The client has already sent a friendship request that has not been handled yet by the user.

  • MaxFriendshipsExceeded – The client has hit the max amount of friendships a user can have at a time. For most accounts this limit is set to 1000 but it could be higher for others.

  • InviteeMaxFriendshipsExceeded – The user you attempted to add has hit the max amount of friendships a user can have at a time.

  • InviteeMaxFriendshipRequestsExceeded – The user you attempted to add has hit the max amount of friendship requests a user can have at a time. This is usually 700 total requests.

  • Forbidden – The client is not allowed to send friendship requests to the user because of the users settings.

  • HTTPException – An error occured while requesting to add this friend.

display_name

The users displayname

Warning

The display name will be the one registered to the epicgames account. If an epicgames account is not found it defaults to the display name of an external auth.

Warning

This property might be None if Client.fetch_user_data_in_events is set to False.

Type

Optional[str]

epicgames_account

Tells you if the user is an account registered to epicgames services. False if the user is from another platform without having linked their account to an epicgames account.

Warning

If this is True, the display name will be the one registered to the epicgames account, if not it defaults to the display name of an external auth.

Warning

This property might be False even though the account is a registered epic games account if Client.fetch_user_data_in_events is set to False.

Type

bool

external_auths

List containing information about external auths. Might be empty if the user does not have any external auths.

Type

List[ExternalAuth]

await fetch()[source]

This function is a coroutine.

Fetches basic information about this user and sets the updated properties. This might be useful if you for example need to be sure the display name is updated or if you have Client.fetch_user_data_in_events set to False.

Raises

HTTPException – An error occured while requesting.

await fetch_battlepass_level(*, season, start_time=None, end_time=None)[source]

This function is a coroutine.

Fetches this users battlepass level.

Parameters
  • season (int) –

    The season number to request the battlepass level for.

    Warning

    If you are requesting the previous season and the new season has not been added to the library yet (check SeasonStartTimestamp), you have to manually include the previous seasons end timestamp in epoch seconds.

  • start_time (Optional[Union[int, datetime.datetime, SeasonStartTimestamp]]) – The UTC start time of the window to get the battlepass level from. Must be seconds since epoch, :class:`datetime.datetime` or a constant from SeasonEndTimestamp Defaults to None

  • end_time (Optional[Union[int, datetime.datetime, SeasonEndTimestamp]]) – The UTC end time of the window to get the battlepass level from. Must be seconds since epoch, :class:`datetime.datetime` or a constant from SeasonEndTimestamp Defaults to None

Raises

HTTPException – An error occured while requesting.

Returns

The users battlepass level. None is returned if the user has not played any real matches this season.

Note

The decimals are the percent progress to the next level. E.g. 208.63 -> Level 208 and 63% on the way to 209.

Return type

Optional[float]

await fetch_br_stats(*, start_time=None, end_time=None)[source]

This function is a coroutine.

Fetches this users stats.

Parameters
  • start_time (Optional[Union[int, datetime.datetime, SeasonStartTimestamp]]) – The UTC start time of the time period to get stats from. Must be seconds since epoch, :class:`datetime.datetime` or a constant from SeasonEndTimestamp Defaults to None

  • end_time (Optional[Union[int, datetime.datetime, SeasonEndTimestamp]]) – The UTC end time of the time period to get stats from. Must be seconds since epoch, :class:`datetime.datetime` or a constant from SeasonEndTimestamp Defaults to None

Raises
  • Forbidden – The user has chosen to be hidden from public stats by disabling the fortnite setting below. Settings -> Account and Privacy -> Show on career     leaderboard

  • HTTPException – An error occured while requesting.

Returns

An object representing the stats for this user.

Return type

StatsV2

await fetch_br_stats_collection(collection, start_time=None, end_time=None)[source]

This function is a coroutine.

Fetches a stats collections for this user.

Parameters
  • start_time (Optional[Union[int, datetime.datetime, SeasonStartTimestamp]]) – The UTC start time of the time period to get stats from. Must be seconds since epoch, :class:`datetime.datetime` or a constant from SeasonEndTimestamp Defaults to None

  • end_time (Optional[Union[int, datetime.datetime, SeasonEndTimestamp]]) – The UTC end time of the time period to get stats from. Must be seconds since epoch, :class:`datetime.datetime` or a constant from SeasonEndTimestamp Defaults to None

Raises
  • Forbidden – The user has chosen to be hidden from public stats by disabling the fortnite setting below. Settings -> Account and Privacy -> Show on career     leaderboard

  • HTTPException – An error occured while requesting.

Returns

An object representing the stats collection for this user.

Return type

StatsCollection

id

The users id

Type

str

jid

The JID of the user.

Type

aioxmpp.JID

BlockedUser

class fortnitepy.BlockedUser[source]

Represents a blocked user from Fortnite

await unblock()[source]

This function is a coroutine.

Unblocks this friend.

display_name

The users displayname

Warning

The display name will be the one registered to the epicgames account. If an epicgames account is not found it defaults to the display name of an external auth.

Warning

This property might be None if Client.fetch_user_data_in_events is set to False.

Type

Optional[str]

epicgames_account

Tells you if the user is an account registered to epicgames services. False if the user is from another platform without having linked their account to an epicgames account.

Warning

If this is True, the display name will be the one registered to the epicgames account, if not it defaults to the display name of an external auth.

Warning

This property might be False even though the account is a registered epic games account if Client.fetch_user_data_in_events is set to False.

Type

bool

external_auths

List containing information about external auths. Might be empty if the user does not have any external auths.

Type

List[ExternalAuth]

await fetch()[source]

This function is a coroutine.

Fetches basic information about this user and sets the updated properties. This might be useful if you for example need to be sure the display name is updated or if you have Client.fetch_user_data_in_events set to False.

Raises

HTTPException – An error occured while requesting.

await fetch_battlepass_level(*, season, start_time=None, end_time=None)[source]

This function is a coroutine.

Fetches this users battlepass level.

Parameters
  • season (int) –

    The season number to request the battlepass level for.

    Warning

    If you are requesting the previous season and the new season has not been added to the library yet (check SeasonStartTimestamp), you have to manually include the previous seasons end timestamp in epoch seconds.

  • start_time (Optional[Union[int, datetime.datetime, SeasonStartTimestamp]]) – The UTC start time of the window to get the battlepass level from. Must be seconds since epoch, :class:`datetime.datetime` or a constant from SeasonEndTimestamp Defaults to None

  • end_time (Optional[Union[int, datetime.datetime, SeasonEndTimestamp]]) – The UTC end time of the window to get the battlepass level from. Must be seconds since epoch, :class:`datetime.datetime` or a constant from SeasonEndTimestamp Defaults to None

Raises

HTTPException – An error occured while requesting.

Returns

The users battlepass level. None is returned if the user has not played any real matches this season.

Note

The decimals are the percent progress to the next level. E.g. 208.63 -> Level 208 and 63% on the way to 209.

Return type

Optional[float]

await fetch_br_stats(*, start_time=None, end_time=None)[source]

This function is a coroutine.

Fetches this users stats.

Parameters
  • start_time (Optional[Union[int, datetime.datetime, SeasonStartTimestamp]]) – The UTC start time of the time period to get stats from. Must be seconds since epoch, :class:`datetime.datetime` or a constant from SeasonEndTimestamp Defaults to None

  • end_time (Optional[Union[int, datetime.datetime, SeasonEndTimestamp]]) – The UTC end time of the time period to get stats from. Must be seconds since epoch, :class:`datetime.datetime` or a constant from SeasonEndTimestamp Defaults to None

Raises
  • Forbidden – The user has chosen to be hidden from public stats by disabling the fortnite setting below. Settings -> Account and Privacy -> Show on career     leaderboard

  • HTTPException – An error occured while requesting.

Returns

An object representing the stats for this user.

Return type

StatsV2

await fetch_br_stats_collection(collection, start_time=None, end_time=None)[source]

This function is a coroutine.

Fetches a stats collections for this user.

Parameters
  • start_time (Optional[Union[int, datetime.datetime, SeasonStartTimestamp]]) – The UTC start time of the time period to get stats from. Must be seconds since epoch, :class:`datetime.datetime` or a constant from SeasonEndTimestamp Defaults to None

  • end_time (Optional[Union[int, datetime.datetime, SeasonEndTimestamp]]) – The UTC end time of the time period to get stats from. Must be seconds since epoch, :class:`datetime.datetime` or a constant from SeasonEndTimestamp Defaults to None

Raises
  • Forbidden – The user has chosen to be hidden from public stats by disabling the fortnite setting below. Settings -> Account and Privacy -> Show on career     leaderboard

  • HTTPException – An error occured while requesting.

Returns

An object representing the stats collection for this user.

Return type

StatsCollection

id

The users id

Type

str

jid

The JID of the user.

Type

aioxmpp.JID

UserSearchEntry

class fortnitepy.UserSearchEntry[source]

Represents a user entry in a user search.

Parameters
  • matches (List[Tuple[str, UserSearchPlatform]]) –

    A list of tuples containing the display name the user matched

    and the platform the display name is from. | Example: [('Tfue', UserSearchPlatform.EPIC_GAMES)]

  • match_type (UserSearchMatchType) – The type of match this user matched by.

  • mutual_friend_count (int) – The amount of epic mutual friends the client has with the user.

await add()[source]

This function is a coroutine.

Sends a friendship request to this user or adds them if they have already sent one to the client.

Raises
  • NotFound – The specified user does not exist.

  • DuplicateFriendship – The client is already friends with this user.

  • FriendshipRequestAlreadySent – The client has already sent a friendship request that has not been handled yet by the user.

  • MaxFriendshipsExceeded – The client has hit the max amount of friendships a user can have at a time. For most accounts this limit is set to 1000 but it could be higher for others.

  • InviteeMaxFriendshipsExceeded – The user you attempted to add has hit the max amount of friendships a user can have at a time.

  • InviteeMaxFriendshipRequestsExceeded – The user you attempted to add has hit the max amount of friendship requests a user can have at a time. This is usually 700 total requests.

  • Forbidden – The client is not allowed to send friendship requests to the user because of the users settings.

  • HTTPException – An error occured while requesting to add this friend.

await block()[source]

This function is a coroutine.

Blocks this user.

Raises

HTTPException – Something went wrong while blocking this user.

display_name

The users displayname

Warning

The display name will be the one registered to the epicgames account. If an epicgames account is not found it defaults to the display name of an external auth.

Warning

This property might be None if Client.fetch_user_data_in_events is set to False.

Type

Optional[str]

epicgames_account

Tells you if the user is an account registered to epicgames services. False if the user is from another platform without having linked their account to an epicgames account.

Warning

If this is True, the display name will be the one registered to the epicgames account, if not it defaults to the display name of an external auth.

Warning

This property might be False even though the account is a registered epic games account if Client.fetch_user_data_in_events is set to False.

Type

bool

external_auths

List containing information about external auths. Might be empty if the user does not have any external auths.

Type

List[ExternalAuth]

await fetch()[source]

This function is a coroutine.

Fetches basic information about this user and sets the updated properties. This might be useful if you for example need to be sure the display name is updated or if you have Client.fetch_user_data_in_events set to False.

Raises

HTTPException – An error occured while requesting.

await fetch_battlepass_level(*, season, start_time=None, end_time=None)[source]

This function is a coroutine.

Fetches this users battlepass level.

Parameters
  • season (int) –

    The season number to request the battlepass level for.

    Warning

    If you are requesting the previous season and the new season has not been added to the library yet (check SeasonStartTimestamp), you have to manually include the previous seasons end timestamp in epoch seconds.

  • start_time (Optional[Union[int, datetime.datetime, SeasonStartTimestamp]]) – The UTC start time of the window to get the battlepass level from. Must be seconds since epoch, :class:`datetime.datetime` or a constant from SeasonEndTimestamp Defaults to None

  • end_time (Optional[Union[int, datetime.datetime, SeasonEndTimestamp]]) – The UTC end time of the window to get the battlepass level from. Must be seconds since epoch, :class:`datetime.datetime` or a constant from SeasonEndTimestamp Defaults to None

Raises

HTTPException – An error occured while requesting.

Returns

The users battlepass level. None is returned if the user has not played any real matches this season.

Note

The decimals are the percent progress to the next level. E.g. 208.63 -> Level 208 and 63% on the way to 209.

Return type

Optional[float]

await fetch_br_stats(*, start_time=None, end_time=None)[source]

This function is a coroutine.

Fetches this users stats.

Parameters
  • start_time (Optional[Union[int, datetime.datetime, SeasonStartTimestamp]]) – The UTC start time of the time period to get stats from. Must be seconds since epoch, :class:`datetime.datetime` or a constant from SeasonEndTimestamp Defaults to None

  • end_time (Optional[Union[int, datetime.datetime, SeasonEndTimestamp]]) – The UTC end time of the time period to get stats from. Must be seconds since epoch, :class:`datetime.datetime` or a constant from SeasonEndTimestamp Defaults to None

Raises
  • Forbidden – The user has chosen to be hidden from public stats by disabling the fortnite setting below. Settings -> Account and Privacy -> Show on career     leaderboard

  • HTTPException – An error occured while requesting.

Returns

An object representing the stats for this user.

Return type

StatsV2

await fetch_br_stats_collection(collection, start_time=None, end_time=None)[source]

This function is a coroutine.

Fetches a stats collections for this user.

Parameters
  • start_time (Optional[Union[int, datetime.datetime, SeasonStartTimestamp]]) – The UTC start time of the time period to get stats from. Must be seconds since epoch, :class:`datetime.datetime` or a constant from SeasonEndTimestamp Defaults to None

  • end_time (Optional[Union[int, datetime.datetime, SeasonEndTimestamp]]) – The UTC end time of the time period to get stats from. Must be seconds since epoch, :class:`datetime.datetime` or a constant from SeasonEndTimestamp Defaults to None

Raises
  • Forbidden – The user has chosen to be hidden from public stats by disabling the fortnite setting below. Settings -> Account and Privacy -> Show on career     leaderboard

  • HTTPException – An error occured while requesting.

Returns

An object representing the stats collection for this user.

Return type

StatsCollection

id

The users id

Type

str

jid

The JID of the user.

Type

aioxmpp.JID

SacSearchEntryUser

class fortnitepy.SacSearchEntryUser[source]

Represents a user entry in a support a creator code search.

Parameters
  • slug (str) – The slug (creator code) that matched.

  • active (bool) – Wether or not the creator code is active or not.

  • verified (bool) – Wether or not the creator code is verified or not.

await add()[source]

This function is a coroutine.

Sends a friendship request to this user or adds them if they have already sent one to the client.

Raises
  • NotFound – The specified user does not exist.

  • DuplicateFriendship – The client is already friends with this user.

  • FriendshipRequestAlreadySent – The client has already sent a friendship request that has not been handled yet by the user.

  • MaxFriendshipsExceeded – The client has hit the max amount of friendships a user can have at a time. For most accounts this limit is set to 1000 but it could be higher for others.

  • InviteeMaxFriendshipsExceeded – The user you attempted to add has hit the max amount of friendships a user can have at a time.

  • InviteeMaxFriendshipRequestsExceeded – The user you attempted to add has hit the max amount of friendship requests a user can have at a time. This is usually 700 total requests.

  • Forbidden – The client is not allowed to send friendship requests to the user because of the users settings.

  • HTTPException – An error occured while requesting to add this friend.

await block()[source]

This function is a coroutine.

Blocks this user.

Raises

HTTPException – Something went wrong while blocking this user.

display_name

The users displayname

Warning

The display name will be the one registered to the epicgames account. If an epicgames account is not found it defaults to the display name of an external auth.

Warning

This property might be None if Client.fetch_user_data_in_events is set to False.

Type

Optional[str]

epicgames_account

Tells you if the user is an account registered to epicgames services. False if the user is from another platform without having linked their account to an epicgames account.

Warning

If this is True, the display name will be the one registered to the epicgames account, if not it defaults to the display name of an external auth.

Warning

This property might be False even though the account is a registered epic games account if Client.fetch_user_data_in_events is set to False.

Type

bool

external_auths

List containing information about external auths. Might be empty if the user does not have any external auths.

Type

List[ExternalAuth]

await fetch()[source]

This function is a coroutine.

Fetches basic information about this user and sets the updated properties. This might be useful if you for example need to be sure the display name is updated or if you have Client.fetch_user_data_in_events set to False.

Raises

HTTPException – An error occured while requesting.

await fetch_battlepass_level(*, season, start_time=None, end_time=None)[source]

This function is a coroutine.

Fetches this users battlepass level.

Parameters
  • season (int) –

    The season number to request the battlepass level for.

    Warning

    If you are requesting the previous season and the new season has not been added to the library yet (check SeasonStartTimestamp), you have to manually include the previous seasons end timestamp in epoch seconds.

  • start_time (Optional[Union[int, datetime.datetime, SeasonStartTimestamp]]) – The UTC start time of the window to get the battlepass level from. Must be seconds since epoch, :class:`datetime.datetime` or a constant from SeasonEndTimestamp Defaults to None

  • end_time (Optional[Union[int, datetime.datetime, SeasonEndTimestamp]]) – The UTC end time of the window to get the battlepass level from. Must be seconds since epoch, :class:`datetime.datetime` or a constant from SeasonEndTimestamp Defaults to None

Raises

HTTPException – An error occured while requesting.

Returns

The users battlepass level. None is returned if the user has not played any real matches this season.

Note

The decimals are the percent progress to the next level. E.g. 208.63 -> Level 208 and 63% on the way to 209.

Return type

Optional[float]

await fetch_br_stats(*, start_time=None, end_time=None)[source]

This function is a coroutine.

Fetches this users stats.

Parameters
  • start_time (Optional[Union[int, datetime.datetime, SeasonStartTimestamp]]) – The UTC start time of the time period to get stats from. Must be seconds since epoch, :class:`datetime.datetime` or a constant from SeasonEndTimestamp Defaults to None

  • end_time (Optional[Union[int, datetime.datetime, SeasonEndTimestamp]]) – The UTC end time of the time period to get stats from. Must be seconds since epoch, :class:`datetime.datetime` or a constant from SeasonEndTimestamp Defaults to None

Raises
  • Forbidden – The user has chosen to be hidden from public stats by disabling the fortnite setting below. Settings -> Account and Privacy -> Show on career     leaderboard

  • HTTPException – An error occured while requesting.

Returns

An object representing the stats for this user.

Return type

StatsV2

await fetch_br_stats_collection(collection, start_time=None, end_time=None)[source]

This function is a coroutine.

Fetches a stats collections for this user.

Parameters
  • start_time (Optional[Union[int, datetime.datetime, SeasonStartTimestamp]]) – The UTC start time of the time period to get stats from. Must be seconds since epoch, :class:`datetime.datetime` or a constant from SeasonEndTimestamp Defaults to None

  • end_time (Optional[Union[int, datetime.datetime, SeasonEndTimestamp]]) – The UTC end time of the time period to get stats from. Must be seconds since epoch, :class:`datetime.datetime` or a constant from SeasonEndTimestamp Defaults to None

Raises
  • Forbidden – The user has chosen to be hidden from public stats by disabling the fortnite setting below. Settings -> Account and Privacy -> Show on career     leaderboard

  • HTTPException – An error occured while requesting.

Returns

An object representing the stats collection for this user.

Return type

StatsCollection

id

The users id

Type

str

jid

The JID of the user.

Type

aioxmpp.JID

Friend

class fortnitepy.Friend[source]

Represents a friend on Fortnite

favorite

True if the friend is favorited by ClientUser else False.

Type

bool

nickname

The friend’s nickname. None if no nickname is set for this friend.

Type

str

note

The friend’s note. None if no note is set.

Type

str

last_presence

The last presence retrieved by the friend. Might be None if no presence has been received by this friend yet.

Type

Presence

last_logout

The UTC time of the last time this friend logged off. None if this friend has never logged into fortnite or because the friend was added after the client was started. If the latter is the case, you can fetch the friends last logout with Friend.fetch_last_logout().

Type

datetime.datetime

platform

The platform the friend is currently online on. None if the friend is offline.

Type

Platform

is_online()[source]

Method to check if a user is currently online.

Warning

This method uses the last received presence from this user to determine if the friend is online or not. Therefore, this method will most likely not return True when calling it in event_friend_add(). You could use Client.wait_for() to wait for the presence to be received but remember that if the friend is infact offline, no presence will be received. You can add a timeout the method to make sure it won’t wait forever.

Returns

True if the friend is currently online else False.

Return type

bool

await wait_until_online()[source]

This function is a coroutine.

Waits until this friend comes online. Returns instantly if already online.

await wait_until_offline()[source]

This function is a coroutine.

Waits until this friend goes offline. Returns instantly if already offline.

await fetch_last_logout()[source]

This function is a coroutine.

Fetches the last time this friend logged out.

Raises

HTTPException – An error occured while requesting.

Returns

The last UTC datetime of this friends last logout. Could be None if the friend has never logged into fortnite.

Return type

Optional[datetime.datetime]

await fetch_mutual_friends()[source]

This function is a coroutine.

Fetches a list of friends you and this friend have in common.

Raises

HTTPException – An error occured while requesting.

Returns

A list of friends you and this friend have in common.

Return type

List[Friend]

await set_nickname(nickname)[source]

This function is a coroutine.

Sets the nickname of this friend.

Parameters

nickname (str) –

The nickname you want to set.
Min length: 3
Max length: 16

Raises
  • ValueError – The nickname contains too few/many characters or contains invalid characters.

  • HTTPException – An error occured while requesting.

await remove_nickname()[source]

This function is a coroutine.

Removes the friend’s nickname.

Raises

HTTPException – An error occured while requesting.

await set_note(note)[source]

This function is a coroutine.

Pins a note to this friend.

Parameters note: str

The note you want to set.
Min length: 3
Max length: 255
Raises
  • ValueError – The note contains too few/many characters or contains invalid characters.

  • HTTPException – An error occured while requesting.

await remove_note()[source]

This function is a coroutine.

Removes the friend’s note.

Raises

HTTPException – An error occured while requesting.

await remove()[source]

This function is a coroutine.

Removes the friend from your friendlist.

Raises

HTTPException – Something went wrong when trying to remove this friend.

await send(content)[source]

This function is a coroutine.

Sends a FriendMessage to this friend.

Parameters

content (str) – The content of the message.

await join_party()[source]

This function is a coroutine.

Attempts to join this friends’ party.

Raises
  • PartyError – Party was not found.

  • Forbidden – The party you attempted to join was private.

  • HTTPException – Something else went wrong when trying to join the party.

Returns

The clients new party.

Return type

ClientParty

await invite()[source]

This function is a coroutine.

Invites this friend to your party.

Raises
Returns

Object representing the sent party invitation.

Return type

SentPartyInvitation

await request_to_join()[source]

This function is a coroutine.

Sends a request to join a friends party. This is mainly used for requesting to join private parties specifically, but it can be used for all types of party privacies.

Warning

If the request is accepted by the receiving friend, the bot will receive a regular party invitation. Unlike the fortnite client, fortnitepy will not automatically accept this invitation. You have to make some logic for doing that yourself.

Raises
await owns_offer(offer_id)[source]

This function is a coroutine.

Checks if a friend owns a currently active offer in the item shop.

Raises
  • InvalidOffer – An invalid/outdated offer_id was passed. Only offers currently in the item shop are valid.

  • HTTPException – An error occured while requesting.

Returns

Whether or not the friend owns the offer.

Return type

bool

await fetch_avatar()[source]

This function is a coroutine.

Fetches this friend’s avatar.

Raises

HTTPException – An error occured while requesting.

Returns

The avatar of the friend.

Return type

Avatar

await block()[source]

This function is a coroutine.

Blocks this friend.

Raises

HTTPException – Something went wrong when trying to block this user.

created_at

The UTC time of when the friendship was created.

Type

datetime.datetime

display_name

The users displayname

Warning

The display name will be the one registered to the epicgames account. If an epicgames account is not found it defaults to the display name of an external auth.

Warning

This property might be None if Client.fetch_user_data_in_events is set to False.

Type

Optional[str]

epicgames_account

Tells you if the user is an account registered to epicgames services. False if the user is from another platform without having linked their account to an epicgames account.

Warning

If this is True, the display name will be the one registered to the epicgames account, if not it defaults to the display name of an external auth.

Warning

This property might be False even though the account is a registered epic games account if Client.fetch_user_data_in_events is set to False.

Type

bool

external_auths

List containing information about external auths. Might be empty if the user does not have any external auths.

Type

List[ExternalAuth]

await fetch()[source]

This function is a coroutine.

Fetches basic information about this user and sets the updated properties. This might be useful if you for example need to be sure the display name is updated or if you have Client.fetch_user_data_in_events set to False.

Raises

HTTPException – An error occured while requesting.

await fetch_battlepass_level(*, season, start_time=None, end_time=None)[source]

This function is a coroutine.

Fetches this users battlepass level.

Parameters
  • season (int) –

    The season number to request the battlepass level for.

    Warning

    If you are requesting the previous season and the new season has not been added to the library yet (check SeasonStartTimestamp), you have to manually include the previous seasons end timestamp in epoch seconds.

  • start_time (Optional[Union[int, datetime.datetime, SeasonStartTimestamp]]) – The UTC start time of the window to get the battlepass level from. Must be seconds since epoch, :class:`datetime.datetime` or a constant from SeasonEndTimestamp Defaults to None

  • end_time (Optional[Union[int, datetime.datetime, SeasonEndTimestamp]]) – The UTC end time of the window to get the battlepass level from. Must be seconds since epoch, :class:`datetime.datetime` or a constant from SeasonEndTimestamp Defaults to None

Raises

HTTPException – An error occured while requesting.

Returns

The users battlepass level. None is returned if the user has not played any real matches this season.

Note

The decimals are the percent progress to the next level. E.g. 208.63 -> Level 208 and 63% on the way to 209.

Return type

Optional[float]

await fetch_br_stats(*, start_time=None, end_time=None)[source]

This function is a coroutine.

Fetches this users stats.

Parameters
  • start_time (Optional[Union[int, datetime.datetime, SeasonStartTimestamp]]) – The UTC start time of the time period to get stats from. Must be seconds since epoch, :class:`datetime.datetime` or a constant from SeasonEndTimestamp Defaults to None

  • end_time (Optional[Union[int, datetime.datetime, SeasonEndTimestamp]]) – The UTC end time of the time period to get stats from. Must be seconds since epoch, :class:`datetime.datetime` or a constant from SeasonEndTimestamp Defaults to None

Raises
  • Forbidden – The user has chosen to be hidden from public stats by disabling the fortnite setting below. Settings -> Account and Privacy -> Show on career     leaderboard

  • HTTPException – An error occured while requesting.

Returns

An object representing the stats for this user.

Return type

StatsV2

await fetch_br_stats_collection(collection, start_time=None, end_time=None)[source]

This function is a coroutine.

Fetches a stats collections for this user.

Parameters
  • start_time (Optional[Union[int, datetime.datetime, SeasonStartTimestamp]]) – The UTC start time of the time period to get stats from. Must be seconds since epoch, :class:`datetime.datetime` or a constant from SeasonEndTimestamp Defaults to None

  • end_time (Optional[Union[int, datetime.datetime, SeasonEndTimestamp]]) – The UTC end time of the time period to get stats from. Must be seconds since epoch, :class:`datetime.datetime` or a constant from SeasonEndTimestamp Defaults to None

Raises
  • Forbidden – The user has chosen to be hidden from public stats by disabling the fortnite setting below. Settings -> Account and Privacy -> Show on career     leaderboard

  • HTTPException – An error occured while requesting.

Returns

An object representing the stats collection for this user.

Return type

StatsCollection

id

The users id

Type

str

inbound

True if this friend was the one to send the friend request else False`. Aliased to ``inbound as well.

Type

bool

incoming

True if this friend was the one to send the friend request else False`. Aliased to ``inbound as well.

Type

bool

jid

The JID of the user.

Type

aioxmpp.JID

outbound

True if the bot was the one to send the friend request else False. Aliased to outbound as well.

Type

bool

outgoing

True if the bot was the one to send the friend request else False. Aliased to outbound as well.

Type

bool

status

The friends status to the client. E.g. if the friend is friends with the bot it will be ACCEPTED.

Warning

This is not the same as status from presence!

Type

str

IncomingPendingFriend

class fortnitepy.IncomingPendingFriend[source]

Represents an incoming pending friend. This means that the client received the friend request.

await accept()[source]

This function is a coroutine.

Accepts this users’ friend request.

Raises

HTTPException – Something went wrong when trying to accept this request.

Returns

Object of the friend you just added.

Return type

Friend

await decline()[source]

This function is a coroutine.

Declines this users’ friend request.

Raises

HTTPException – Something went wrong when trying to decline this request.

await block()[source]

This function is a coroutine.

Blocks this friend.

Raises

HTTPException – Something went wrong when trying to block this user.

created_at

The UTC time of when the request was created

Type

datetime.datetime

display_name

The users displayname

Warning

The display name will be the one registered to the epicgames account. If an epicgames account is not found it defaults to the display name of an external auth.

Warning

This property might be None if Client.fetch_user_data_in_events is set to False.

Type

Optional[str]

epicgames_account

Tells you if the user is an account registered to epicgames services. False if the user is from another platform without having linked their account to an epicgames account.

Warning

If this is True, the display name will be the one registered to the epicgames account, if not it defaults to the display name of an external auth.

Warning

This property might be False even though the account is a registered epic games account if Client.fetch_user_data_in_events is set to False.

Type

bool

external_auths

List containing information about external auths. Might be empty if the user does not have any external auths.

Type

List[ExternalAuth]

await fetch()[source]

This function is a coroutine.

Fetches basic information about this user and sets the updated properties. This might be useful if you for example need to be sure the display name is updated or if you have Client.fetch_user_data_in_events set to False.

Raises

HTTPException – An error occured while requesting.

await fetch_battlepass_level(*, season, start_time=None, end_time=None)[source]

This function is a coroutine.

Fetches this users battlepass level.

Parameters
  • season (int) –

    The season number to request the battlepass level for.

    Warning

    If you are requesting the previous season and the new season has not been added to the library yet (check SeasonStartTimestamp), you have to manually include the previous seasons end timestamp in epoch seconds.

  • start_time (Optional[Union[int, datetime.datetime, SeasonStartTimestamp]]) – The UTC start time of the window to get the battlepass level from. Must be seconds since epoch, :class:`datetime.datetime` or a constant from SeasonEndTimestamp Defaults to None

  • end_time (Optional[Union[int, datetime.datetime, SeasonEndTimestamp]]) – The UTC end time of the window to get the battlepass level from. Must be seconds since epoch, :class:`datetime.datetime` or a constant from SeasonEndTimestamp Defaults to None

Raises

HTTPException – An error occured while requesting.

Returns

The users battlepass level. None is returned if the user has not played any real matches this season.

Note

The decimals are the percent progress to the next level. E.g. 208.63 -> Level 208 and 63% on the way to 209.

Return type

Optional[float]

await fetch_br_stats(*, start_time=None, end_time=None)[source]

This function is a coroutine.

Fetches this users stats.

Parameters
  • start_time (Optional[Union[int, datetime.datetime, SeasonStartTimestamp]]) – The UTC start time of the time period to get stats from. Must be seconds since epoch, :class:`datetime.datetime` or a constant from SeasonEndTimestamp Defaults to None

  • end_time (Optional[Union[int, datetime.datetime, SeasonEndTimestamp]]) – The UTC end time of the time period to get stats from. Must be seconds since epoch, :class:`datetime.datetime` or a constant from SeasonEndTimestamp Defaults to None

Raises
  • Forbidden – The user has chosen to be hidden from public stats by disabling the fortnite setting below. Settings -> Account and Privacy -> Show on career     leaderboard

  • HTTPException – An error occured while requesting.

Returns

An object representing the stats for this user.

Return type

StatsV2

await fetch_br_stats_collection(collection, start_time=None, end_time=None)[source]

This function is a coroutine.

Fetches a stats collections for this user.

Parameters
  • start_time (Optional[Union[int, datetime.datetime, SeasonStartTimestamp]]) – The UTC start time of the time period to get stats from. Must be seconds since epoch, :class:`datetime.datetime` or a constant from SeasonEndTimestamp Defaults to None

  • end_time (Optional[Union[int, datetime.datetime, SeasonEndTimestamp]]) – The UTC end time of the time period to get stats from. Must be seconds since epoch, :class:`datetime.datetime` or a constant from SeasonEndTimestamp Defaults to None

Raises
  • Forbidden – The user has chosen to be hidden from public stats by disabling the fortnite setting below. Settings -> Account and Privacy -> Show on career     leaderboard

  • HTTPException – An error occured while requesting.

Returns

An object representing the stats collection for this user.

Return type

StatsCollection

id

The users id

Type

str

inbound

True if this friend was the one to send the friend request else False`. Aliased to ``inbound as well.

Type

bool

incoming

True if this friend was the one to send the friend request else False`. Aliased to ``inbound as well.

Type

bool

jid

The JID of the user.

Type

aioxmpp.JID

outbound

True if the bot was the one to send the friend request else False. Aliased to outbound as well.

Type

bool

outgoing

True if the bot was the one to send the friend request else False. Aliased to outbound as well.

Type

bool

status

The friends status to the client. E.g. if the friend is friends with the bot it will be ACCEPTED.

Warning

This is not the same as status from presence!

Type

str

OutgoingPendingFriend

class fortnitepy.OutgoingPendingFriend[source]
await cancel()[source]

This function is a coroutine.

Cancel the friend request sent to this user. This method is also aliases to abort().

Raises

HTTPException – Something went wrong when trying to cancel this request.

await abort()[source]

This function is a coroutine.

Cancel the friend request sent to this user. This method is also aliases to abort().

Raises

HTTPException – Something went wrong when trying to cancel this request.

await block()[source]

This function is a coroutine.

Blocks this friend.

Raises

HTTPException – Something went wrong when trying to block this user.

created_at

The UTC time of when the request was created

Type

datetime.datetime

display_name

The users displayname

Warning

The display name will be the one registered to the epicgames account. If an epicgames account is not found it defaults to the display name of an external auth.

Warning

This property might be None if Client.fetch_user_data_in_events is set to False.

Type

Optional[str]

epicgames_account

Tells you if the user is an account registered to epicgames services. False if the user is from another platform without having linked their account to an epicgames account.

Warning

If this is True, the display name will be the one registered to the epicgames account, if not it defaults to the display name of an external auth.

Warning

This property might be False even though the account is a registered epic games account if Client.fetch_user_data_in_events is set to False.

Type

bool

external_auths

List containing information about external auths. Might be empty if the user does not have any external auths.

Type

List[ExternalAuth]

await fetch()[source]

This function is a coroutine.

Fetches basic information about this user and sets the updated properties. This might be useful if you for example need to be sure the display name is updated or if you have Client.fetch_user_data_in_events set to False.

Raises

HTTPException – An error occured while requesting.

await fetch_battlepass_level(*, season, start_time=None, end_time=None)[source]

This function is a coroutine.

Fetches this users battlepass level.

Parameters
  • season (int) –

    The season number to request the battlepass level for.

    Warning

    If you are requesting the previous season and the new season has not been added to the library yet (check SeasonStartTimestamp), you have to manually include the previous seasons end timestamp in epoch seconds.

  • start_time (Optional[Union[int, datetime.datetime, SeasonStartTimestamp]]) – The UTC start time of the window to get the battlepass level from. Must be seconds since epoch, :class:`datetime.datetime` or a constant from SeasonEndTimestamp Defaults to None

  • end_time (Optional[Union[int, datetime.datetime, SeasonEndTimestamp]]) – The UTC end time of the window to get the battlepass level from. Must be seconds since epoch, :class:`datetime.datetime` or a constant from SeasonEndTimestamp Defaults to None

Raises

HTTPException – An error occured while requesting.

Returns

The users battlepass level. None is returned if the user has not played any real matches this season.

Note

The decimals are the percent progress to the next level. E.g. 208.63 -> Level 208 and 63% on the way to 209.

Return type

Optional[float]

await fetch_br_stats(*, start_time=None, end_time=None)[source]

This function is a coroutine.

Fetches this users stats.

Parameters
  • start_time (Optional[Union[int, datetime.datetime, SeasonStartTimestamp]]) – The UTC start time of the time period to get stats from. Must be seconds since epoch, :class:`datetime.datetime` or a constant from SeasonEndTimestamp Defaults to None

  • end_time (Optional[Union[int, datetime.datetime, SeasonEndTimestamp]]) – The UTC end time of the time period to get stats from. Must be seconds since epoch, :class:`datetime.datetime` or a constant from SeasonEndTimestamp Defaults to None

Raises
  • Forbidden – The user has chosen to be hidden from public stats by disabling the fortnite setting below. Settings -> Account and Privacy -> Show on career     leaderboard

  • HTTPException – An error occured while requesting.

Returns

An object representing the stats for this user.

Return type

StatsV2

await fetch_br_stats_collection(collection, start_time=None, end_time=None)[source]

This function is a coroutine.

Fetches a stats collections for this user.

Parameters
  • start_time (Optional[Union[int, datetime.datetime, SeasonStartTimestamp]]) – The UTC start time of the time period to get stats from. Must be seconds since epoch, :class:`datetime.datetime` or a constant from SeasonEndTimestamp Defaults to None

  • end_time (Optional[Union[int, datetime.datetime, SeasonEndTimestamp]]) – The UTC end time of the time period to get stats from. Must be seconds since epoch, :class:`datetime.datetime` or a constant from SeasonEndTimestamp Defaults to None

Raises
  • Forbidden – The user has chosen to be hidden from public stats by disabling the fortnite setting below. Settings -> Account and Privacy -> Show on career     leaderboard

  • HTTPException – An error occured while requesting.

Returns

An object representing the stats collection for this user.

Return type

StatsCollection

id

The users id

Type

str

inbound

True if this friend was the one to send the friend request else False`. Aliased to ``inbound as well.

Type

bool

incoming

True if this friend was the one to send the friend request else False`. Aliased to ``inbound as well.

Type

bool

jid

The JID of the user.

Type

aioxmpp.JID

outbound

True if the bot was the one to send the friend request else False. Aliased to outbound as well.

Type

bool

outgoing

True if the bot was the one to send the friend request else False. Aliased to outbound as well.

Type

bool

status

The friends status to the client. E.g. if the friend is friends with the bot it will be ACCEPTED.

Warning

This is not the same as status from presence!

Type

str

FriendMessage

Methods
class fortnitepy.FriendMessage[source]
await reply(content)[source]

This function is a coroutine.

Replies to the message with the given content.

Parameters

content (str) – The content of the message

author

The author of the message.

Type

Friend

client

The client.

Type

Client

content

The content of the message.

Type

str

created_at

The time of when this message was received in UTC.

Type

datetime.datetime

PartyMessage

Methods
class fortnitepy.PartyMessage[source]
author

The author of a message.

Type

PartyMember

await reply(content)[source]

This function is a coroutine.

Replies to the message with the given content.

Parameters

content (str) – The content of the message

client

The client.

Type

Client

content

The content of the message.

Type

str

created_at

The time of when this message was received in UTC.

Type

datetime.datetime

PartyMember

class fortnitepy.PartyMember[source]

Represents a party member.

client

The client.

Type

Client

await kick()[source]

This function is a coroutine.

Kicks this member from the party.

Raises
  • Forbidden – You are not the leader of the party.

  • PartyError – You attempted to kick yourself.

  • HTTPException – Something else went wrong when trying to kick this member.

await promote()[source]

This function is a coroutine.

Promotes this user to partyleader.

Raises
  • Forbidden – You are not the leader of the party.

  • PartyError – You are already partyleader.

  • HTTPException – Something else went wrong when trying to promote this member.

await chatban(reason=None)[source]

This function is a coroutine.

Bans this member from the party chat. The member can then not send or receive messages but still is a part of the party.

Note

Chatbanned members are only banned for the current party. Whenever the client joins another party, the banlist will be empty.

Parameters

reason (Optional[str]) – The reason for the member being banned.

Raises
await swap_position()[source]

This function is a coroutine.

Swaps the clients party position with this member.

Raises

HTTPException – An error occured while requesting.

await add()[source]

This function is a coroutine.

Sends a friendship request to this user or adds them if they have already sent one to the client.

Raises
  • NotFound – The specified user does not exist.

  • DuplicateFriendship – The client is already friends with this user.

  • FriendshipRequestAlreadySent – The client has already sent a friendship request that has not been handled yet by the user.

  • MaxFriendshipsExceeded – The client has hit the max amount of friendships a user can have at a time. For most accounts this limit is set to 1000 but it could be higher for others.

  • InviteeMaxFriendshipsExceeded – The user you attempted to add has hit the max amount of friendships a user can have at a time.

  • InviteeMaxFriendshipRequestsExceeded – The user you attempted to add has hit the max amount of friendship requests a user can have at a time. This is usually 700 total requests.

  • Forbidden – The client is not allowed to send friendship requests to the user because of the users settings.

  • HTTPException – An error occured while requesting to add this friend.

assisted_challenge

The current assisted challenge chosen by this member. None if no assisted challenge is set.

Type

str

backpack

The BID of the backpack this member currently has equipped. None if no backpack is equipped.

Type

str

backpack_variants

A list containing the raw variants data for the currently equipped backpack.

Warning

Variants doesn’t seem to follow much logic. Therefore this returns the raw variants data received from fortnite’s service. This can be directly passed with the variants keyword to ClientPartyMember.set_backpack().

Type

list

banner

A tuple consisting of the icon id, color id and the season level.

Example output:

('standardbanner15', 'defaultcolor15', 50)
Type

tuple

battlepass_info

A tuple consisting of has purchased, battlepass level, self boost xp, friends boost xp.

Example output:

(True, 30, 80, 70)
Type

tuple

await block()[source]

This function is a coroutine.

Blocks this user.

Raises

HTTPException – Something went wrong while blocking this user.

contrail

The contrail id of the pickaxe this member currently has equipped.

Type

str

contrail_variants

A list containing the raw variants data for the currently equipped contrail.

Warning

Variants doesn’t seem to follow much logic. Therefore this returns the raw variants data received from fortnite’s service. This can be directly passed with the variants keyword to ClientPartyMember.set_contrail().

Type

list

corruption

The corruption value this member is using. None if no corruption value is set.

Type

Optional[float]

staticmethod create_variant(*, config_overrides={}, **kwargs)[source]

Creates the variants list by the variants you set.

Warning

This function is built upon data received from only some of the available outfits with variants. There is little logic behind the variants function therefore there might be some unexpected issues with this function. Please report such issues by creating an issue on the issue tracker or by reporting it to me on discord.

Example usage:

# set the outfit to soccer skin with Norwegian jersey and
# the jersey number set to 99 (max number).
async def set_soccer_skin():
    me = client.party.me

    variants = me.create_variant(
        pattern=0,
        numeric=99,
        jersey_color='Norway'
    )

    await me.set_outfit(
        asset='CID_149_Athena_Commando_F_SoccerGirlB',
        variants=variants
    )
Parameters
  • config_overrides (Dict[str, str]) –

    A config that overrides the default config for the variant backend names. Example:

    # NOTE: Keys refer to the kwarg name.
    # NOTE: Values must include exactly one empty format bracket.
    {
        'particle': 'Mat{}'
    }
    

  • pattern (Optional[int]) – The pattern number you want to use.

  • numeric (Optional[int]) – The numeric number you want to use.

  • clothing_color (Optional[int]) – The clothing color you want to use.

  • jersey_color (Optional[str]) – The jersey color you want to use. For soccer skins this is the country you want the jersey to represent.

  • parts (Optional[int]) – The parts number you want to use.

  • progressive (Optional[int]) – The progressing number you want to use.

  • particle (Optional[int]) – The particle number you want to use.

  • material (Optional[int]) – The material number you want to use.

  • emissive (Optional[int]) – The emissive number you want to use.

  • profile_banner (Optional[str]) – The profile banner to use. The value should almost always be ProfileBanner.

Returns

List of dictionaries including all variants data.

Return type

List[dict]

staticmethod create_variants(*, config_overrides={}, **kwargs)[source]

Creates the variants list by the variants you set.

Warning

This function is built upon data received from only some of the available outfits with variants. There is little logic behind the variants function therefore there might be some unexpected issues with this function. Please report such issues by creating an issue on the issue tracker or by reporting it to me on discord.

Example usage:

# set the outfit to soccer skin with Norwegian jersey and
# the jersey number set to 99 (max number).
async def set_soccer_skin():
    me = client.party.me

    variants = me.create_variant(
        pattern=0,
        numeric=99,
        jersey_color='Norway'
    )

    await me.set_outfit(
        asset='CID_149_Athena_Commando_F_SoccerGirlB',
        variants=variants
    )
Parameters
  • config_overrides (Dict[str, str]) –

    A config that overrides the default config for the variant backend names. Example:

    # NOTE: Keys refer to the kwarg name.
    # NOTE: Values must include exactly one empty format bracket.
    {
        'particle': 'Mat{}'
    }
    

  • pattern (Optional[int]) – The pattern number you want to use.

  • numeric (Optional[int]) – The numeric number you want to use.

  • clothing_color (Optional[int]) – The clothing color you want to use.

  • jersey_color (Optional[str]) – The jersey color you want to use. For soccer skins this is the country you want the jersey to represent.

  • parts (Optional[int]) – The parts number you want to use.

  • progressive (Optional[int]) – The progressing number you want to use.

  • particle (Optional[int]) – The particle number you want to use.

  • material (Optional[int]) – The material number you want to use.

  • emissive (Optional[int]) – The emissive number you want to use.

  • profile_banner (Optional[str]) – The profile banner to use. The value should almost always be ProfileBanner.

Returns

List of dictionaries including all variants data.

Return type

List[dict]

display_name

The users displayname

Warning

The display name will be the one registered to the epicgames account. If an epicgames account is not found it defaults to the display name of an external auth.

Warning

This property might be None if Client.fetch_user_data_in_events is set to False.

Type

Optional[str]

emoji

The ID of the emoji this member is currently playing. None if no emoji is currently playing.

Type

Optional[str]

emote

The EID of the emote this member is currently playing. None if no emote is currently playing.

Type

Optional[str]

enlightenments

A list of tuples containing the enlightenments of this member.

Type

List[tuple]

epicgames_account

Tells you if the user is an account registered to epicgames services. False if the user is from another platform without having linked their account to an epicgames account.

Warning

If this is True, the display name will be the one registered to the epicgames account, if not it defaults to the display name of an external auth.

Warning

This property might be False even though the account is a registered epic games account if Client.fetch_user_data_in_events is set to False.

Type

bool

external_auths

List containing information about external auths. Might be empty if the user does not have any external auths.

Type

List[ExternalAuth]

await fetch()[source]

This function is a coroutine.

Fetches basic information about this user and sets the updated properties. This might be useful if you for example need to be sure the display name is updated or if you have Client.fetch_user_data_in_events set to False.

Raises

HTTPException – An error occured while requesting.

await fetch_battlepass_level(*, season, start_time=None, end_time=None)[source]

This function is a coroutine.

Fetches this users battlepass level.

Parameters
  • season (int) –

    The season number to request the battlepass level for.

    Warning

    If you are requesting the previous season and the new season has not been added to the library yet (check SeasonStartTimestamp), you have to manually include the previous seasons end timestamp in epoch seconds.

  • start_time (Optional[Union[int, datetime.datetime, SeasonStartTimestamp]]) – The UTC start time of the window to get the battlepass level from. Must be seconds since epoch, :class:`datetime.datetime` or a constant from SeasonEndTimestamp Defaults to None

  • end_time (Optional[Union[int, datetime.datetime, SeasonEndTimestamp]]) – The UTC end time of the window to get the battlepass level from. Must be seconds since epoch, :class:`datetime.datetime` or a constant from SeasonEndTimestamp Defaults to None

Raises

HTTPException – An error occured while requesting.

Returns

The users battlepass level. None is returned if the user has not played any real matches this season.

Note

The decimals are the percent progress to the next level. E.g. 208.63 -> Level 208 and 63% on the way to 209.

Return type

Optional[float]

await fetch_br_stats(*, start_time=None, end_time=None)[source]

This function is a coroutine.

Fetches this users stats.

Parameters
  • start_time (Optional[Union[int, datetime.datetime, SeasonStartTimestamp]]) – The UTC start time of the time period to get stats from. Must be seconds since epoch, :class:`datetime.datetime` or a constant from SeasonEndTimestamp Defaults to None

  • end_time (Optional[Union[int, datetime.datetime, SeasonEndTimestamp]]) – The UTC end time of the time period to get stats from. Must be seconds since epoch, :class:`datetime.datetime` or a constant from SeasonEndTimestamp Defaults to None

Raises
  • Forbidden – The user has chosen to be hidden from public stats by disabling the fortnite setting below. Settings -> Account and Privacy -> Show on career     leaderboard

  • HTTPException – An error occured while requesting.

Returns

An object representing the stats for this user.

Return type

StatsV2

await fetch_br_stats_collection(collection, start_time=None, end_time=None)[source]

This function is a coroutine.

Fetches a stats collections for this user.

Parameters
  • start_time (Optional[Union[int, datetime.datetime, SeasonStartTimestamp]]) – The UTC start time of the time period to get stats from. Must be seconds since epoch, :class:`datetime.datetime` or a constant from SeasonEndTimestamp Defaults to None

  • end_time (Optional[Union[int, datetime.datetime, SeasonEndTimestamp]]) – The UTC end time of the time period to get stats from. Must be seconds since epoch, :class:`datetime.datetime` or a constant from SeasonEndTimestamp Defaults to None

Raises
  • Forbidden – The user has chosen to be hidden from public stats by disabling the fortnite setting below. Settings -> Account and Privacy -> Show on career     leaderboard

  • HTTPException – An error occured while requesting.

Returns

An object representing the stats collection for this user.

Return type

StatsCollection

hidden

Whether or not the member is currently hidden in the party. A member can only be hidden if a bot is the leader, therefore this attribute rarely is used.

Type

bool

id

The users id

Type

str

in_match()[source]

Whether or not this member is currently in a match.

Returns

True if this member is in a match else False.

Return type

bool

input

The input type this user is currently using.

Type

str

is_chatbanned()[source]

bool: Whether or not this member is chatbanned.

is_just_chatting()[source]

bool: Whether or not the member is Just Chattin’ through the mobile app.

Warning

All attributes below will most likely have default values if this is True.

is_ready()[source]

Whether or not this member is ready.

Returns

True if this member is ready else False.

Return type

bool

is_zombie()[source]

bool: Whether or not this member is in a zombie mode meaning their xmpp connection is disconnected and not responding.

jid

The JID of the user.

Type

aioxmpp.JID

joined_at

The UTC time of when this member joined its party.

Type

datetime.datetime

leader

Returns True if member is the leader else False.

Type

bool

lobby_map_marker_coordinates

A tuple containing the x and y coordinates of this members current lobby map marker.

Note

Check if the marker is currently visible with PartyMember.lobby_map_marker_is_visible().

Note

The coordinates range is roughly -135000.0 <= coordinate <= 135000

Type

Tuple[float, float]

lobby_map_marker_is_visible()[source]

Whether or not this members lobby map marker is currently visible.

Returns

True if this members lobby map marker is currently visible else False.

Return type

bool

match_players_left

How many players there are left in this players match.

Returns

How many players there are left in this members current match. Defaults to 0 if not in a match.

Return type

int

match_started_at

The time in UTC that the members match started. None if not in a match.

Type

Optional[datetime.datetime]

offline_ttl

The amount of time this member will stay in a zombie mode before expiring.

Type

int

outfit

The CID of the outfit this user currently has equipped.

Type

str

outfit_variants

A list containing the raw variants data for the currently equipped outfit.

Warning

Variants doesn’t seem to follow much logic. Therefore this returns the raw variants data received from fortnite’s service. This can be directly passed with the variants keyword to ClientPartyMember.set_outfit().

Type

list

party

The party this member is a part of.

Type

Union[Party, ClientParty]

pet

The ID of the pet this member currently has equipped. None if no pet is equipped.

Type

str

pickaxe

The pickaxe id of the pickaxe this member currently has equipped.

Type

str

pickaxe_variants

A list containing the raw variants data for the currently equipped pickaxe.

Warning

Variants doesn’t seem to follow much logic. Therefore this returns the raw variants data received from fortnite’s service. This can be directly passed with the variants keyword to ClientPartyMember.set_pickaxe().

Type

list

platform

The platform this user currently uses.

Type

Platform

position

Returns this members position in the party. This position is what defines which team you’re apart of in the party. The position can be any number from 0-15 (16 in total).

0-3 = Team 1
4-7 = Team 2
8-11 = Team 3
12-15 = Team 4
Type

int

ready

The members ready state.

Type

ReadyState

will_yield_leadership

Whether or not this member will promote another member as soon as there is a chance for it. This is usually only True for Just Chattin’ members.

Type

bool

zombie_since

The utc datetime this member went into a zombie state. None if this user is currently not a zombie.

Type

Optional[datetime.datetime]

ClientPartyMember

class fortnitepy.ClientPartyMember[source]

Represents the clients party member.

client

The client.

Type

Client

await edit(*coros)[source]

This function is a coroutine.

Edits multiple meta parts at once.

This example sets the clients outfit to galaxy and banner to the epic banner with level 100:

from functools import partial

async def edit_client_member():
    member = client.party.me
    await member.edit(
        member.set_outfit('CID_175_Athena_Commando_M_Celestial'), # usage with non-awaited coroutines
        partial(member.set_banner, icon="OtherBanner28", season_level=100) # usage with functools.partial()
    )
Parameters

*coros (Union[asyncio.coroutine, functools.partial]) – A list of coroutines that should be included in the edit.

Raises

HTTPException – Something went wrong while editing.

await edit_and_keep(*coros)[source]

This function is a coroutine.

Edits multiple meta parts at once and keeps the changes for when the bot joins other parties.

This example sets the clients outfit to galaxy and banner to the epic banner with level 100. When the client joins another party, the outfit and banner will automatically be equipped:

from functools import partial

async def edit_and_keep_client_member():
    member = client.party.me
    await member.edit_and_keep(
        partial(member.set_outfit, 'CID_175_Athena_Commando_M_Celestial'),
        partial(member.set_banner, icon="OtherBanner28", season_level=100)
    )
Parameters

*coros (functools.partial) – A list of coroutines that should be included in the edit. Unlike ClientPartyMember.edit(), this method only takes coroutines in the form of a functools.partial.

Raises

HTTPException – Something went wrong while editing.

await leave()[source]

This function is a coroutine.

Leaves the party.

Raises

HTTPException – An error occured while requesting to leave the party.

Returns

The new party the client is connected to after leaving.

Return type

ClientParty

await set_ready(state)[source]

This function is a coroutine.

Sets the readiness of the client.

Parameters

state (ReadyState) – The ready state you wish to set.

await set_outfit(asset=None, *, key=None, variants=None, enlightenment=None, corruption=None)[source]

This function is a coroutine.

Sets the outfit of the client.

Parameters
  • asset (Optional[str]) –

    The CID of the outfit.
    Defaults to the last set outfit.

    Note

    You don’t have to include the full path of the asset. The CID is enough.

  • key (Optional[str]) – The encyption key to use for this skin.

  • variants (Optional[list]) – The variants to use for this outfit. Defaults to None which resets variants.

  • enlightenment (Optional[Union[list, Tuple]]) –

    A list/tuple containing exactly two integer values describing the season and the level you want to enlighten the current loadout with.

    Note

    Using enlightenments often requires you to set a specific variant for the skin.

    Example.:

    # First value is the season in Fortnite Chapter 2
    # Second value is the level for the season
    (1, 300)
    

  • corruption (Optional[float]) –

    The corruption value to use for the loadout.

    Note

    Unlike enlightenment you do not need to set any variants yourself as that is handled by the library.

Raises

HTTPException – An error occured while requesting.

await set_backpack(asset=None, *, key=None, variants=None, enlightenment=None, corruption=None)[source]

This function is a coroutine.

Sets the backpack of the client.

Parameters
  • asset (Optional[str]) –

    The BID of the backpack.
    Defaults to the last set backpack.

    Note

    You don’t have to include the full path of the asset. The CID is enough.

  • key (Optional[str]) – The encyption key to use for this backpack.

  • variants (Optional[list]) – The variants to use for this backpack. Defaults to None which resets variants.

  • enlightenment (Optional[Union[list, Tuple]]) –

    A list/tuple containing exactly two integer values describing the season and the level you want to enlighten the current loadout with.

    Note

    Using enlightenments often requires you to set a specific variant for the skin.

    Example.:

    # First value is the season in Fortnite Chapter 2
    # Second value is the level for the season
    (1, 300)
    

  • corruption (Optional[float]) –

    The corruption value to use for the loadout.

    Note

    Unlike enlightenment you do not need to set any variants yourself as that is handled by the library.

Raises

HTTPException – An error occured while requesting.

await clear_backpack()[source]

This function is a coroutine.

Clears the currently set backpack.

Raises

HTTPException – An error occured while requesting.

await set_pet(asset=None, *, key=None, variants=None)[source]

This function is a coroutine.

Sets the pet of the client.

Parameters
  • asset (Optional[str]) –

    The ID of the pet.
    Defaults to the last set pet.

    Note

    You don’t have to include the full path of the asset. The ID is enough.

  • key (Optional[str]) – The encyption key to use for this pet.

  • variants (Optional[list]) – The variants to use for this pet. Defaults to None which resets variants.

Raises

HTTPException – An error occured while requesting.

await clear_pet()[source]

This function is a coroutine.

Clears the currently set pet.

Raises

HTTPException – An error occured while requesting.

await set_pickaxe(asset=None, *, key=None, variants=None)[source]

This function is a coroutine.

Sets the pickaxe of the client.

Parameters
  • asset (Optional[str]) –

    The PID of the pickaxe.
    Defaults to the last set pickaxe.

    Note

    You don’t have to include the full path of the asset. The CID is enough.

  • key (Optional[str]) – The encyption key to use for this pickaxe.

  • variants (Optional[list]) – The variants to use for this pickaxe. Defaults to None which resets variants.

Raises

HTTPException – An error occured while requesting.

await set_contrail(asset=None, *, key=None, variants=None)[source]

This function is a coroutine.

Sets the contrail of the client.

Parameters
  • asset (Optional[str]) –

    The ID of the contrail.
    Defaults to the last set contrail.

    Note

    You don’t have to include the full path of the asset. The ID is enough.

  • key (Optional[str]) – The encyption key to use for this contrail.

  • variants (Optional[list]) – The variants to use for this contrail. Defaults to None which resets variants.

Raises

HTTPException – An error occured while requesting.

await clear_contrail()[source]

This function is a coroutine.

Clears the currently set contrail.

Raises

HTTPException – An error occured while requesting.

await set_emote(asset, *, run_for=None, key=None, section=None)[source]

This function is a coroutine.

Sets the emote of the client.

Parameters
  • asset (str) –

    The EID of the emote.

    Note

    You don’t have to include the full path of the asset. The EID is enough.

  • run_for (Optional[float]) – Seconds the emote should run for before being cancelled. None (default) means it will run indefinitely and you can then clear it with PartyMember.clear_emote().

  • key (Optional[str]) – The encyption key to use for this emote.

  • section (Optional[int]) – The section.

Raises

HTTPException – An error occured while requesting.

await set_emoji(asset, *, run_for=2, key=None, section=None)[source]

This function is a coroutine.

Sets the emoji of the client.

Parameters
  • asset (str) –

    The ID of the emoji.

    Note

    You don’t have to include the full path of the asset. The ID is enough.

  • run_for (Optional[float]) – Seconds the emoji should run for before being cancelled. None means it will run indefinitely and you can then clear it with PartyMember.clear_emote(). Defaults to 2 seconds which is roughly the time an emoji naturally plays for. Note that an emoji is only cleared visually and audibly when the emoji naturally ends, not when PartyMember.clear_emote() is called.

  • key (Optional[str]) – The encyption key to use for this emoji.

  • section (Optional[int]) – The section.

Raises

HTTPException – An error occured while requesting.

await clear_emote()[source]

This function is a coroutine.

Clears/stops the emote currently playing.

Raises

HTTPException – An error occured while requesting.

await set_banner(icon=None, color=None, season_level=None)[source]

This function is a coroutine.

Sets the banner of the client.

Parameters
  • icon (Optional[str]) – The icon to use. Defaults to standardbanner15

  • color (Optional[str]) – The color to use. Defaults to defaultcolor15

  • season_level (Optional[int]) – The season level. Defaults to 1

Raises

HTTPException – An error occured while requesting.

await set_battlepass_info(has_purchased=None, level=None, self_boost_xp=None, friend_boost_xp=None)[source]

This function is a coroutine.

Sets the battlepass info of the client.

Note

This is simply just for showing off. It just shows visually so boostxp, level and stuff will not work, just show.

Parameters
  • has_purchased (Optional[bool]) – Shows visually that you have purchased the battlepass. Defaults to False

  • level (Optional[int]) – Sets the level and shows it visually. Defaults to 1

  • self_boost_xp (Optional[int]) – Sets the self boost xp and shows it visually.

  • friend_boost_xp (Optional[int]) – Set the friend boost xp and shows it visually.

Raises

HTTPException – An error occured while requesting.

await set_assisted_challenge(quest=None, *, num_completed=None)[source]

This function is a coroutine.

Sets the assisted challenge.

Parameters
  • quest (Optional[str]) –

    The quest to set.

    Note

    You don’t have to include the full path of the quest. The quest id is enough.

  • num_completed (Optional[int]) – How many quests you have completed, I think (didn’t test this).

Raises

HTTPException – An error occured while requesting.

await clear_assisted_challenge()[source]

This function is a coroutine.

Clears the currently set assisted challenge.

Raises

HTTPException – An error occured while requesting.

await set_position(position)[source]

This function is a coroutine.

The the clients party position.

Parameters

position (int) – An integer ranging from 0-15. If a position is already held by someone else, then the client and the existing holder will swap positions.

Raises
await set_in_match(*, players_left=100, started_at=None)[source]

This function is a coroutine.

Sets the clients party member in a visible match state.

Note

This is only visual in the party and is not a method for joining a match.

Parameters
  • players_left (int) – How many players that should be displayed left in your game. Defaults to 100.

  • started_at (datetime.datetime) – The match start time in UTC. A timer is visually displayed showing how long the match has lasted. Defaults to the current time (utcnow).

Raises

HTTPException – An error occured while requesting.

await clear_in_match()[source]

This function is a coroutine.

Clears the clients “in match” state.

Raises

HTTPException – An error occured while requesting.

await set_lobby_map_marker(x, y)[source]

This function is a coroutine.

Sets the clients lobby map marker.

Parameters
  • x (float) – The horizontal x coordinate. The x range is roughly -135000.0 <= x <= 135000.

  • y (float) – The vertical y coordinate. The y range is roughly -135000.0 <= y <= 135000.

Raises

HTTPException – An error occured while requesting.

await clear_lobby_map_marker()[source]

This function is a coroutine.

Clears and hides the clients current lobby map marker.

Raises

HTTPException – An error occured while requesting.

await add()[source]

This function is a coroutine.

Sends a friendship request to this user or adds them if they have already sent one to the client.

Raises
  • NotFound – The specified user does not exist.

  • DuplicateFriendship – The client is already friends with this user.

  • FriendshipRequestAlreadySent – The client has already sent a friendship request that has not been handled yet by the user.

  • MaxFriendshipsExceeded – The client has hit the max amount of friendships a user can have at a time. For most accounts this limit is set to 1000 but it could be higher for others.

  • InviteeMaxFriendshipsExceeded – The user you attempted to add has hit the max amount of friendships a user can have at a time.

  • InviteeMaxFriendshipRequestsExceeded – The user you attempted to add has hit the max amount of friendship requests a user can have at a time. This is usually 700 total requests.

  • Forbidden – The client is not allowed to send friendship requests to the user because of the users settings.

  • HTTPException – An error occured while requesting to add this friend.

assisted_challenge

The current assisted challenge chosen by this member. None if no assisted challenge is set.

Type

str

backpack

The BID of the backpack this member currently has equipped. None if no backpack is equipped.

Type

str

backpack_variants

A list containing the raw variants data for the currently equipped backpack.

Warning

Variants doesn’t seem to follow much logic. Therefore this returns the raw variants data received from fortnite’s service. This can be directly passed with the variants keyword to ClientPartyMember.set_backpack().

Type

list

banner

A tuple consisting of the icon id, color id and the season level.

Example output:

('standardbanner15', 'defaultcolor15', 50)
Type

tuple

battlepass_info

A tuple consisting of has purchased, battlepass level, self boost xp, friends boost xp.

Example output:

(True, 30, 80, 70)
Type

tuple

await block()[source]

This function is a coroutine.

Blocks this user.

Raises

HTTPException – Something went wrong while blocking this user.

contrail

The contrail id of the pickaxe this member currently has equipped.

Type

str

contrail_variants

A list containing the raw variants data for the currently equipped contrail.

Warning

Variants doesn’t seem to follow much logic. Therefore this returns the raw variants data received from fortnite’s service. This can be directly passed with the variants keyword to ClientPartyMember.set_contrail().

Type

list

corruption

The corruption value this member is using. None if no corruption value is set.

Type

Optional[float]

staticmethod create_variant(*, config_overrides={}, **kwargs)[source]

Creates the variants list by the variants you set.

Warning

This function is built upon data received from only some of the available outfits with variants. There is little logic behind the variants function therefore there might be some unexpected issues with this function. Please report such issues by creating an issue on the issue tracker or by reporting it to me on discord.

Example usage:

# set the outfit to soccer skin with Norwegian jersey and
# the jersey number set to 99 (max number).
async def set_soccer_skin():
    me = client.party.me

    variants = me.create_variant(
        pattern=0,
        numeric=99,
        jersey_color='Norway'
    )

    await me.set_outfit(
        asset='CID_149_Athena_Commando_F_SoccerGirlB',
        variants=variants
    )
Parameters
  • config_overrides (Dict[str, str]) –

    A config that overrides the default config for the variant backend names. Example:

    # NOTE: Keys refer to the kwarg name.
    # NOTE: Values must include exactly one empty format bracket.
    {
        'particle': 'Mat{}'
    }
    

  • pattern (Optional[int]) – The pattern number you want to use.

  • numeric (Optional[int]) – The numeric number you want to use.

  • clothing_color (Optional[int]) – The clothing color you want to use.

  • jersey_color (Optional[str]) – The jersey color you want to use. For soccer skins this is the country you want the jersey to represent.

  • parts (Optional[int]) – The parts number you want to use.

  • progressive (Optional[int]) – The progressing number you want to use.

  • particle (Optional[int]) – The particle number you want to use.

  • material (Optional[int]) – The material number you want to use.

  • emissive (Optional[int]) – The emissive number you want to use.

  • profile_banner (Optional[str]) – The profile banner to use. The value should almost always be ProfileBanner.

Returns

List of dictionaries including all variants data.

Return type

List[dict]

staticmethod create_variants(*, config_overrides={}, **kwargs)[source]

Creates the variants list by the variants you set.

Warning

This function is built upon data received from only some of the available outfits with variants. There is little logic behind the variants function therefore there might be some unexpected issues with this function. Please report such issues by creating an issue on the issue tracker or by reporting it to me on discord.

Example usage:

# set the outfit to soccer skin with Norwegian jersey and
# the jersey number set to 99 (max number).
async def set_soccer_skin():
    me = client.party.me

    variants = me.create_variant(
        pattern=0,
        numeric=99,
        jersey_color='Norway'
    )

    await me.set_outfit(
        asset='CID_149_Athena_Commando_F_SoccerGirlB',
        variants=variants
    )
Parameters
  • config_overrides (Dict[str, str]) –

    A config that overrides the default config for the variant backend names. Example:

    # NOTE: Keys refer to the kwarg name.
    # NOTE: Values must include exactly one empty format bracket.
    {
        'particle': 'Mat{}'
    }
    

  • pattern (Optional[int]) – The pattern number you want to use.

  • numeric (Optional[int]) – The numeric number you want to use.

  • clothing_color (Optional[int]) – The clothing color you want to use.

  • jersey_color (Optional[str]) – The jersey color you want to use. For soccer skins this is the country you want the jersey to represent.

  • parts (Optional[int]) – The parts number you want to use.

  • progressive (Optional[int]) – The progressing number you want to use.

  • particle (Optional[int]) – The particle number you want to use.

  • material (Optional[int]) – The material number you want to use.

  • emissive (Optional[int]) – The emissive number you want to use.

  • profile_banner (Optional[str]) – The profile banner to use. The value should almost always be ProfileBanner.

Returns

List of dictionaries including all variants data.

Return type

List[dict]

display_name

The users displayname

Warning

The display name will be the one registered to the epicgames account. If an epicgames account is not found it defaults to the display name of an external auth.

Warning

This property might be None if Client.fetch_user_data_in_events is set to False.

Type

Optional[str]

emoji

The ID of the emoji this member is currently playing. None if no emoji is currently playing.

Type

Optional[str]

emote

The EID of the emote this member is currently playing. None if no emote is currently playing.

Type

Optional[str]

enlightenments

A list of tuples containing the enlightenments of this member.

Type

List[tuple]

epicgames_account

Tells you if the user is an account registered to epicgames services. False if the user is from another platform without having linked their account to an epicgames account.

Warning

If this is True, the display name will be the one registered to the epicgames account, if not it defaults to the display name of an external auth.

Warning

This property might be False even though the account is a registered epic games account if Client.fetch_user_data_in_events is set to False.

Type

bool

external_auths

List containing information about external auths. Might be empty if the user does not have any external auths.

Type

List[ExternalAuth]

await fetch()[source]

This function is a coroutine.

Fetches basic information about this user and sets the updated properties. This might be useful if you for example need to be sure the display name is updated or if you have Client.fetch_user_data_in_events set to False.

Raises

HTTPException – An error occured while requesting.

await fetch_battlepass_level(*, season, start_time=None, end_time=None)[source]

This function is a coroutine.

Fetches this users battlepass level.

Parameters
  • season (int) –

    The season number to request the battlepass level for.

    Warning

    If you are requesting the previous season and the new season has not been added to the library yet (check SeasonStartTimestamp), you have to manually include the previous seasons end timestamp in epoch seconds.

  • start_time (Optional[Union[int, datetime.datetime, SeasonStartTimestamp]]) – The UTC start time of the window to get the battlepass level from. Must be seconds since epoch, :class:`datetime.datetime` or a constant from SeasonEndTimestamp Defaults to None

  • end_time (Optional[Union[int, datetime.datetime, SeasonEndTimestamp]]) – The UTC end time of the window to get the battlepass level from. Must be seconds since epoch, :class:`datetime.datetime` or a constant from SeasonEndTimestamp Defaults to None

Raises

HTTPException – An error occured while requesting.

Returns

The users battlepass level. None is returned if the user has not played any real matches this season.

Note

The decimals are the percent progress to the next level. E.g. 208.63 -> Level 208 and 63% on the way to 209.

Return type

Optional[float]

await fetch_br_stats(*, start_time=None, end_time=None)[source]

This function is a coroutine.

Fetches this users stats.

Parameters
  • start_time (Optional[Union[int, datetime.datetime, SeasonStartTimestamp]]) – The UTC start time of the time period to get stats from. Must be seconds since epoch, :class:`datetime.datetime` or a constant from SeasonEndTimestamp Defaults to None

  • end_time (Optional[Union[int, datetime.datetime, SeasonEndTimestamp]]) – The UTC end time of the time period to get stats from. Must be seconds since epoch, :class:`datetime.datetime` or a constant from SeasonEndTimestamp Defaults to None

Raises
  • Forbidden – The user has chosen to be hidden from public stats by disabling the fortnite setting below. Settings -> Account and Privacy -> Show on career     leaderboard

  • HTTPException – An error occured while requesting.

Returns

An object representing the stats for this user.

Return type

StatsV2

await fetch_br_stats_collection(collection, start_time=None, end_time=None)[source]

This function is a coroutine.

Fetches a stats collections for this user.

Parameters
  • start_time (Optional[Union[int, datetime.datetime, SeasonStartTimestamp]]) – The UTC start time of the time period to get stats from. Must be seconds since epoch, :class:`datetime.datetime` or a constant from SeasonEndTimestamp Defaults to None

  • end_time (Optional[Union[int, datetime.datetime, SeasonEndTimestamp]]) – The UTC end time of the time period to get stats from. Must be seconds since epoch, :class:`datetime.datetime` or a constant from SeasonEndTimestamp Defaults to None

Raises
  • Forbidden – The user has chosen to be hidden from public stats by disabling the fortnite setting below. Settings -> Account and Privacy -> Show on career     leaderboard

  • HTTPException – An error occured while requesting.

Returns

An object representing the stats collection for this user.

Return type

StatsCollection

hidden

Whether or not the member is currently hidden in the party. A member can only be hidden if a bot is the leader, therefore this attribute rarely is used.

Type

bool

id

The users id

Type

str

in_match()[source]

Whether or not this member is currently in a match.

Returns

True if this member is in a match else False.

Return type

bool

input

The input type this user is currently using.

Type

str

is_chatbanned()[source]

bool: Whether or not this member is chatbanned.

is_just_chatting()[source]

bool: Whether or not the member is Just Chattin’ through the mobile app.

Warning

All attributes below will most likely have default values if this is True.

is_ready()[source]

Whether or not this member is ready.

Returns

True if this member is ready else False.

Return type

bool

is_zombie()[source]

bool: Whether or not this member is in a zombie mode meaning their xmpp connection is disconnected and not responding.

jid

The JID of the user.

Type

aioxmpp.JID

joined_at

The UTC time of when this member joined its party.

Type

datetime.datetime

leader

Returns True if member is the leader else False.

Type

bool

lobby_map_marker_coordinates

A tuple containing the x and y coordinates of this members current lobby map marker.

Note

Check if the marker is currently visible with PartyMember.lobby_map_marker_is_visible().

Note

The coordinates range is roughly -135000.0 <= coordinate <= 135000

Type

Tuple[float, float]

lobby_map_marker_is_visible()[source]

Whether or not this members lobby map marker is currently visible.

Returns

True if this members lobby map marker is currently visible else False.

Return type

bool

match_players_left

How many players there are left in this players match.

Returns

How many players there are left in this members current match. Defaults to 0 if not in a match.

Return type

int

match_started_at

The time in UTC that the members match started. None if not in a match.

Type

Optional[datetime.datetime]

offline_ttl

The amount of time this member will stay in a zombie mode before expiring.

Type

int

outfit

The CID of the outfit this user currently has equipped.

Type

str

outfit_variants

A list containing the raw variants data for the currently equipped outfit.

Warning

Variants doesn’t seem to follow much logic. Therefore this returns the raw variants data received from fortnite’s service. This can be directly passed with the variants keyword to ClientPartyMember.set_outfit().

Type

list

party

The party this member is a part of.

Type

Union[Party, ClientParty]

pet

The ID of the pet this member currently has equipped. None if no pet is equipped.

Type

str

pickaxe

The pickaxe id of the pickaxe this member currently has equipped.

Type

str

pickaxe_variants

A list containing the raw variants data for the currently equipped pickaxe.

Warning

Variants doesn’t seem to follow much logic. Therefore this returns the raw variants data received from fortnite’s service. This can be directly passed with the variants keyword to ClientPartyMember.set_pickaxe().

Type

list

platform

The platform this user currently uses.

Type

Platform

position

Returns this members position in the party. This position is what defines which team you’re apart of in the party. The position can be any number from 0-15 (16 in total).

0-3 = Team 1
4-7 = Team 2
8-11 = Team 3
12-15 = Team 4
Type

int

ready

The members ready state.

Type

ReadyState

will_yield_leadership

Whether or not this member will promote another member as soon as there is a chance for it. This is usually only True for Just Chattin’ members.

Type

bool

zombie_since

The utc datetime this member went into a zombie state. None if this user is currently not a zombie.

Type

Optional[datetime.datetime]

JustChattingClientPartyMember

class fortnitepy.JustChattingClientPartyMember(client, party, data)[source]

Represents the clients party member in a just chattin state from kairos.

Warning

The actions you can do with this party member type is very limited. For example if you were to change the clients outfit, it would override the just chattin state with no way of getting back to the state in the current party.

You can read about all attributes and methods here: ClientPartyMember

Party

class fortnitepy.Party[source]

Represent a party that the ClientUser is not yet a part of.

await join()[source]

This function is a coroutine.

Joins the party.

Raises
  • . warning:: – Because the client has to leave its current party before joining a new one, a new party is created if some of these errors are raised. Most of the time though this is not the case and the client will remain in its current party.

  • PartyError – You are already a member of this party.

  • NotFound – The party was not found.

  • Forbidden – You are not allowed to join this party because it’s private and you have not been a part of it before. .. note:: If you have been a part of the party before but got kicked, you are ineligible to join this party and this error is raised.

  • HTTPException – An error occurred when requesting to join the party.

Returns

The party that was just joined.

Return type

ClientParty

applicants

The party’s applicants.

Type

list

client

The client.

Type

Client

get_member(user_id)[source]

Optional[PartyMember]: Attempts to get a party member from the member cache. Returns None if no user was found by the user id.

id

The party’s id.

Type

str

leader

The leader of the party.

Type

PartyMember

member_count

The amount of member currently in this party.

Type

int

members

A copied list of the members currently in this party.

Type

List[PartyMember]

playlist_info

A tuple containing the name, tournament, event window and region of the currently set playlist.

Example output:

# output for default duos
(
    'Playlist_DefaultDuo',
    '',
    '',
    'EU'
)

# output for arena trios
(
    'Playlist_ShowdownAlt_Trios',
    'epicgames_Arena_S10_Trios',
    'Arena_S10_Division1_Trios',
    'EU'
)
Type

tuple

privacy

The currently set privacy of this party.

Type

PartyPrivacy

squad_assignments

The squad assignments for this party. This includes information about a members position and visibility.

Type

Dict[PartyMember, SquadAssignment]

squad_fill

True if squad fill is enabled else False.

Type

bool

ClientParty

class fortnitepy.ClientParty[source]

Represents ClientUser’s party.

me

The clients partymember object.

Type

ClientPartyMember

muc_jid

The JID of the party MUC.

Type

aioxmpp.JID

chatbanned_members

Dict[str, PartyMember] A dict of all chatbanned members mapped to their user id.

await send(content)[source]

This function is a coroutine.

Sends a message to this party’s chat.

Parameters

content (str) – The content of the message.

await edit(*coros)[source]

This function is a coroutine.

Edits multiple meta parts at once.

Example:

from functools import partial

async def edit_party():
    party = client.party
    await party.edit(
        party.set_privacy(fortnitepy.PartyPrivacy.PRIVATE), # usage with non-awaited coroutines
        partial(party.set_custom_key, 'myawesomekey') # usage with functools.partial()
    )
Parameters

*coros (Union[asyncio.coroutine, functools.partial]) – A list of coroutines that should be included in the edit.

Raises

HTTPException – Something went wrong while editing.

await edit_and_keep(*coros)[source]

This function is a coroutine.

Edits multiple meta parts at once and keeps the changes for when new parties are created.

This example sets the custom key to myawesomekey and the playlist to Creative in the Europe region.:

from functools import partial

async def edit_and_keep_party():
    party = client.party
    await party.edit_and_keep(
        partial(party.set_custom_key, 'myawesomekey'),
        partial(party.set_playlist, 'Playlist_PlaygroundV2', region=fortnitepy.Region.EUROPE)
    )
Parameters

*coros (functools.partial) – A list of coroutines that should be included in the edit. Unlike ClientParty.edit(), this method only takes coroutines in the form of a functools.partial.

Raises

HTTPException – Something went wrong while editing.

await set_squad_assignments(assignments)[source]

This function is a coroutine.

Sets squad assignments for members of the party.

Parameters

assignments (Dict[PartyMember, SquadAssignment]) –

Pre-defined assignments to set. If a member is missing from this dict, they will be automatically added to the final request.

Example:

{
    member1: fortnitepy.SquadAssignment(position=5),
    member2: fortnitepy.SquadAssignment(hidden=True)
}

Raises
  • ValueError – Duplicate positions were set in the assignments.

  • Forbidden – You are not the leader of the party.

  • HTTPException – An error occured while requesting.

await invite(user_id)[source]

This function is a coroutine.

Invites a user to the party.

Parameters

user_id (str) – The id of the user to invite.

Raises
  • PartyError – User is already in your party.

  • PartyError – The party is full.

  • Forbidden – The invited user is not friends with the client.

  • HTTPException – Something else went wrong when trying to invite the user.

Returns

Object representing the sent party invitation.

Return type

SentPartyInvitation

await fetch_invites()[source]

This function is a coroutine.

Fetches all active invitations sent from the party.

Warning

Because of an error on fortnite’s end, this method only returns invites sent from other party members if the party is private. However it will always return invites sent from the client regardless of party privacy.

Raises

HTTPException – An error occured while requesting from fortnite’s services.

Returns

A list of all sent invites from the party.

Return type

List[SentPartyInvitation]

await set_privacy(privacy)[source]

This function is a coroutine.

Sets the privacy of the party.

Parameters

privacy (PartyPrivacy) –

Raises

Forbidden – The client is not the leader of the party.

await set_playlist(playlist=None, tournament=None, event_window=None, region=None)[source]

This function is a coroutine.

Sets the current playlist of the party.

Sets the playlist to Duos EU:

await party.set_playlist(
    playlist='Playlist_DefaultDuo',
    region=fortnitepy.Region.EUROPE
)

Sets the playlist to Arena Trios EU (Replace Trios with Solo for arena solo):

await party.set_playlist(
    playlist='Playlist_ShowdownAlt_Trios',
    tournament='epicgames_Arena_S13_Trios',
    event_window='Arena_S13_Division1_Trios',
    region=fortnitepy.Region.EUROPE
)
Parameters
  • playlist (Optional[str]) – The name of the playlist. Defaults to Region.EUROPE

  • tournament (Optional[str]) – The tournament id.

  • event_window (Optional[str]) – The event window id.

  • region (Optional[Region]) – The region to use. Defaults to :attr:`Region.EUROPE`

Raises

Forbidden – The client is not the leader of the party.

await set_custom_key(key)[source]

This function is a coroutine.

Sets the custom key of the party.

Parameters

key (str) – The key to set.

Raises

Forbidden – The client is not the leader of the party.

await set_fill(value)[source]

This function is a coroutine.

Sets the fill status of the party.

Parameters

value (bool) –

What to set the fill status to.

True sets it to ‘Fill’ False sets it to ‘NoFill’

Raises

Forbidden – The client is not the leader of the party.

await set_max_size(size)[source]

This function is a coroutine.

Sets a new max size of the party.

Parameters

size (int) – The size to set. Must be more than the current member count, more than or equal to 1 or less than or equal to 16.

Raises
  • Forbidden – The client is not the leader of the party.

  • PartyError – The new size was lower than the current member count.

  • PartyError – The new size was not <= 1 and <= 16.

applicants

The party’s applicants.

Type

list

client

The client.

Type

Client

get_member(user_id)[source]

Optional[PartyMember]: Attempts to get a party member from the member cache. Returns None if no user was found by the user id.

id

The party’s id.

Type

str

leader

The leader of the party.

Type

PartyMember

member_count

The amount of member currently in this party.

Type

int

members

A copied list of the members currently in this party.

Type

List[PartyMember]

playlist_info

A tuple containing the name, tournament, event window and region of the currently set playlist.

Example output:

# output for default duos
(
    'Playlist_DefaultDuo',
    '',
    '',
    'EU'
)

# output for arena trios
(
    'Playlist_ShowdownAlt_Trios',
    'epicgames_Arena_S10_Trios',
    'Arena_S10_Division1_Trios',
    'EU'
)
Type

tuple

privacy

The currently set privacy of this party.

Type

PartyPrivacy

squad_assignments

The squad assignments for this party. This includes information about a members position and visibility.

Type

Dict[PartyMember, SquadAssignment]

squad_fill

True if squad fill is enabled else False.

Type

bool

ReceivedPartyInvitation

Methods
class fortnitepy.ReceivedPartyInvitation[source]

Represents a received party invitation.

client

The client.

Type

Client

party

The party the invitation belongs to.

Type

Party

net_cl

The net_cl received by the sending client.

Type

str

sender

The friend that invited you to the party.

Type

Friend

created_at

The UTC time this invite was created at.

Type

datetime.datetime

await accept()[source]

This function is a coroutine.

Accepts the invitation and joins the party.

Warning

A bug within the fortnite services makes it not possible to join a private party you have been kicked from.

Raises
  • Forbidden – You attempted to join a private party you’ve been kicked from.

  • HTTPException – Something went wrong when accepting the invitation.

Returns

The party the client joined by accepting the invitation.

Return type

ClientParty

await decline()[source]

This function is a coroutine.

Declines the invitation.

Raises
  • PartyError – The clients net_cl is not compatible with the received net_cl.

  • HTTPException – Something went wrong when declining the invitation.

SentPartyInvitation

Methods
class fortnitepy.SentPartyInvitation[source]

Represents a sent party invitation.

client

The client.

Type

Client

party

The party the invitation belongs to.

Type

Party

sender

The party member that sent the invite.

Type

PartyMember

receiver

The user that the invite was sent to.

Type

User

created_at

The UTC time this invite was created at.

Type

datetime.datetime

await cancel()[source]

This function is a coroutine.

Cancels the invite. The user will see an error message saying something like <users>'s party is private.

Raises
  • Forbidden – Attempted to cancel an invite not sent by the client.

  • HTTPException – Something went wrong while requesting to cancel the invite.

await resend()[source]

This function is a coroutine.

Resends an invite with a new notification popping up for the receiving user.

Raises
  • Forbidden – Attempted to resend an invite not sent by the client.

  • HTTPException – Something went wrong while requesting to resend the invite.

PartyJoinConfirmation

Methods
class fortnitepy.PartyJoinConfirmation[source]

Represents a join confirmation.

client

The client.

Type

Client

party

The party the user wants to join.

Type

ClientParty

user

The user who requested to join the party.

Type

User

created_at

The UTC time of when the join confirmation was received.

Type

datetime.datetime

await confirm()[source]

This function is a coroutine.

Confirms this user.

Note

This call does not guarantee that the player will end up in the clients party. Please always listen to event_party_member_join() to ensure that the player in fact joined.

Raises

HTTPException – Something went wrong when confirming this user.

await reject()[source]

This function is a coroutine.

Rejects this user.

Raises

HTTPException – Something went wrong when rejecting this user.

PartyJoinRequest

Methods
class fortnitepy.PartyJoinRequest(client, party, friend, data)[source]

Represents a party join request. These requests are in most cases only received when the bots party privacy is set to private.

client

The client.

Type

Client

party

The party the user wants to join.

Type

ClientParty

friend

The friend who requested to join the party.

Type

Friend

created_at

The UTC timestamp of when this join request was created.

Type

datetime.datetime

expires_at

The UTC timestamp of when this join request will expire. This should always be one minute after its creation.

Type

datetime.datetime

await accept()[source]

This function is a coroutine.

Accepts a party join request. Accepting this before the request has expired forces the sender to join the party. If not then the sender will receive a regular party invite.

Raises

Presence

class fortnitepy.Presence[source]

Represents a presence received from a friend

client

The client.

Type

Client

available

Whether or not the user is online. True if the friend is or went online, False if the friend went offline.

Type

bool

away

The users away status.

Type

AwayStatus

friend

The friend you received this presence from.

Type

Friend

platform

The platform this presence was sent from.

Type

Platform

received_at

The UTC time of when the client received this presence.

Type

datetime.datetime

status

The friend’s status.

Type

str

playing

Says if friend is playing.

Type

bool

joinable

Says if friend is joinable.

Type

bool

session_id

The friend’s current session id. Often referred to as server key or game key. Returns None if the friend is not currently in a game.

Type

str

has_properties

True if the presence has properties else False.

Warning

All attributes below this point will be None if has_properties is False.

Type

bool

party

The friend’s party.

Type

PresenceParty

gameplay_stats

The friend’s gameplay stats. Will be None if no gameplay stats are currently availble.

Type

Optional[PresenceGameplayStats]

homebase_rating

The friend’s homebase rating

Type

str

lfg

True if the friend is currently looking for a game.

Type

bool

sub_game

The friend’s current subgame.

Type

str

in_unjoinable_match

True if friend is in unjoinable match else False.

Type

bool

playlist

The friend’s current playlist.

Type

str

party_size

The size of the friend’s party.

Type

int

max_party_size

The max size of the friend’s party.

Type

int

game_session_join_key

The join key of the friend’s session.

Type

str

server_player_count

The playercount of the friend’s server.

Type

str

PresenceParty

class fortnitepy.PresenceParty[source]

Represents a party received from presence.

Before accessing any of this class’ attributes or functions you should always check if the party is private:

@client.event
async def event_friend_presence(before, after):
    # after is the newly received presence
    presence = after

    # check if presence is from the account 'Terbau'
    # NOTE: you should always use id over display_name
    # but for this example i've use display_name just
    # to demonstrate.
    if presence.friend.display_name != 'Terbau':
        return

    # check if party is private
    if presence.party.private:
        return

    # if all the checks above succeeds we join the party
    await presence.party.join()

Note

If the party is private, all attributes below private will be None.

client

The client.

Type

str

private

True if the party is private else False.

Type

bool

platform

The platform of the friend.

Type

Platform

id

The party’s id.

Type

str

party_type_id

The party’s type id.

Type

str

key

The party’s key.

Type

str

app_id

The party’s app id.

Type

str

build_id

The party’s build id. Similar format to Client.party_build_id.

Type

str

net_cl

The party’s net_cl. Similar format to Client.net_cl.

Type

str

party_flags

The party’s flags.

Type

str

not_accepting_reason

The party’s not accepting reason.

Type

str

playercount

The party’s playercount.

Type

int

await join()[source]

This function is a coroutine.

Joins the friends’ party.

Raises
  • PartyError – You are already a member of this party.

  • Forbidden – The party is private.

  • HTTPException – Something else went wrong when trying to join this party.

Returns

The party that was just joined.

Return type

ClientParty

PresenceGameplayStats

class fortnitepy.PresenceGameplayStats[source]

Represents gameplaystats received from presence.

friend

The friend these stats belong to.

Type

Friend

state

The state.

Note

It’s not really known what value this property might hold. This is pretty much always an empty string.

Type

str

playlist

The playlist.

Note

The playlist from the gameplay stats property usually isn’t updated. Consider using Presence.playlist instead as that seems to always be the correct playlist.

Type

str

players_alive

The amount of players alive in the current game.

Type

int

kills

The amount of kills the friend currently has. Aliased to num_kills as well for legacy reasons.

Type

int

fell_to_death

True if friend fell to death in its current game, else False

Type

bool

StatsV2

class fortnitepy.StatsV2[source]

Represents a users Battle Royale stats on Fortnite.

get_kd(data)[source]

Gets the kd of a gamemode

Usage:

# gets ninjas kd in solo on input touch
async def get_ninja_touch_solo_kd():
    user = await client.fetch_user('Ninja')
    stats = await client.fetch_br_stats(user.id)

    return stats.get_kd(stats.get_stats()['touch']['defaultsolo'])
Parameters

data (dict) – A dict which atleast includes the keys: kills, matchesplayed and wins.

Returns

Returns the kd with a decimal point accuracy of two.

Return type

float

get_winpercentage(data)[source]

Gets the winpercentage of a gamemode

Usage:

# gets ninjas winpercentage in solo on input touch
async def get_ninja_touch_solo_winpercentage():
    user = await client.fetch_user('Ninja')
    stats = await client.fetch_br_stats(user.id)

    return stats.get_winpercentage(stats.get_stats()['touch']['defaultsolo'])
Parameters

data (dict) – A dict which atleast includes the keys: matchesplayed`` and wins.

Returns

Returns the winpercentage with a decimal point accuracy of two.

Return type

float

get_stats()[source]

Gets the stats for this user. This function returns the users stats.

Returns

Mapping of the users stats. All stats are mapped to their respective gamemodes.

Return type

dict

get_combined_stats(platforms=True)[source]

Gets combined stats for this user.

Parameters

platforms (bool) –

True if the combined stats should be mapped to their

respective region. | False to return all stats combined across platforms.

Returns

Mapping of the users stats combined. All stats are added together and no longer sorted into their respective gamemodes.

Return type

dict

StatsCollection

Attributes
Methods
class fortnitepy.StatsCollection[source]

Represents a users Battle Royale stats collection on Fortnite.

name

The collection name.

Type

str

get_stats()[source]

Gets the stats collection for this user. This function returns the users collection.

Returns

Mapping of the users collection.

Return type

dict

BattleRoyaleNewsPost

class fortnitepy.BattleRoyaleNewsPost[source]
image

The image url of this post.

Type

str

hidden

True if post is hidden else False.

Type

bool

type

The type of this message.

Type

str

title

The title of this post.

Type

str

body

The actual message of this post.

Type

str

spotlight

True if this post is in the spotlight else False.

Type

bool

adspace

The adspace of this post. None if no adspace is found.

Type

str

Store

class fortnitepy.Store[source]

Object representing store data from Fortnite Battle Royale.

client

The client.

Type

Client

featured_items

A list containing data about featured items in the item shop.

Type

List[FeaturedStoreItem]

daily_items

A list containing data about daily items in the item shop.

Type

List[DailyStoreItem]

A list containing data about special featured items in the item shop.

Type

List[FeaturedStoreItem]

special_daily_items

A list containing data about special daily items in the item shop.

Type

List[DailyStoreItem]

daily_purchase_hours

How many hours a day it is possible to purchase items. It most likely is 24.

Type

int

refresh_interval_hours

Refresh interval hours.

Type

int

created_at

The UTC time of the creation and current day.

Type

datetime.datetime

expires_at

The UTC time of when this item shop expires.

Type

datetime.datetime

FeaturedStoreItem

class fortnitepy.FeaturedStoreItem[source]

Featured store item.

panel

The panel the item is listed in from left to right.

Type

int

asset

The asset of the item. Usually a CID or or something similar. Could be None if not found.

Type

str

asset_path

The asset path of the item. Could be None if not found.

Type

str

daily_limit

The daily account limit for this item. -1 = Unlimited.

Type

int

dev_name

The dev name of this item.

Type

str

display_names

The display names for this item.

Type

List[str]

encryption_key

The encryption key for this item. If no encryption key is found, this will be None.

Type

str

gifts_enabled

True if gifts is enabled for this item else False.

Type

bool

grants

A list of items you get from this purchase.

Typical output:

[{
    'quantity': 1,
    'type': 'AthenaCharacter',
    'asset': 'cid_318_athena_commando_m_demon'
}]
Type

list

monthly_limit

The monthly account limit for this item. -1 = Unlimited.

Type

int

new

True if the item is in the item shop for the first time, else False.

Type

bool

offer_id

The offer id of this item.

Type

str

offer_type

The offer type of this item.

Type

str

price

The price of this item in v-bucks.

Type

int

refundable

True if item is refundable else False.

Type

bool

violator

The violator of this item. Violator is the red tag at the top of an item in the shop. Will be None if no violator is found for this item.

Type

str

weekly_limit

The weekly account limit for this item. -1 = Unlimited.

Type

int

DailyStoreItem

class fortnitepy.DailyStoreItem[source]

Daily store item.

asset

The asset of the item. Usually a CID or or something similar. Could be None if not found.

Type

str

asset_path

The asset path of the item. Could be None if not found.

Type

str

daily_limit

The daily account limit for this item. -1 = Unlimited.

Type

int

dev_name

The dev name of this item.

Type

str

display_names

The display names for this item.

Type

List[str]

encryption_key

The encryption key for this item. If no encryption key is found, this will be None.

Type

str

gifts_enabled

True if gifts is enabled for this item else False.

Type

bool

grants

A list of items you get from this purchase.

Typical output:

[{
    'quantity': 1,
    'type': 'AthenaCharacter',
    'asset': 'cid_318_athena_commando_m_demon'
}]
Type

list

monthly_limit

The monthly account limit for this item. -1 = Unlimited.

Type

int

new

True if the item is in the item shop for the first time, else False.

Type

bool

offer_id

The offer id of this item.

Type

str

offer_type

The offer type of this item.

Type

str

price

The price of this item in v-bucks.

Type

int

refundable

True if item is refundable else False.

Type

bool

violator

The violator of this item. Violator is the red tag at the top of an item in the shop. Will be None if no violator is found for this item.

Type

str

weekly_limit

The weekly account limit for this item. -1 = Unlimited.

Type

int

Playlist

class fortnitepy.Playlist[source]
image_url

Image url for the playlist.

Type

str

internal_name

The internal name of the playlist.

Type

str

type

The type of this playlist object.

Type

str

special_border

Special border of the playlist. Will be None if no special border is found for this playlist.

Type

Optional[str]

violator

The violater displayed for this playlist. This is the little red tag displaying short text on some of the playlists in-game. Will be None if no violator is found for this playlist.

Type

Optional[str]

display_subname

The display subname of this playlist. Will be None if no display subname is found for this playlist.

Type

Optional[str]

description

The description of this playlist. Will be None if no description is found for this playlist.

Type

Optional[str]

Data Classes

Data classes used as data containers in the library.

DefaultPartyConfig

class fortnitepy.DefaultPartyConfig[source]

Data class for the default party configuration used when a new party is created.

Parameters
  • privacy (Optional[PartyPrivacy]) –

    The party privacy that should be used.
    Defaults to: PartyPrivacy.PUBLIC

  • max_size (Optional[int]) –

    The maximun party size. Valid party sizes must use a value

    between 1 and 16. | Defaults to 16

  • chat_enabled (Optional[bool]) –

    Wether or not the party chat should be enabled for the party.
    Defaults to True.

  • team_change_allowed (bool) –

    Whether or not players should be able to manually swap party team

    with another player. This setting only works if the client is the leader of the party. | Defaults to True

  • default_squad_assignment (SquadAssignment) –

    The default squad assignment to use for new members. Squad assignments

    holds information about a party member’s current position and visibility. Please note that setting a position in the default squad assignment doesnt actually do anything and it will just be overridden. | Defaults to SquadAssignment(hidden=False).

  • position_priorities (List[int]) –

    A list of exactly 16 ints all ranging from 0-15. When a new member

    joins the party or a member is not defined in a squad assignment request, it will automatically give the first available position in this list. | Defaults to a list of 0-15 in order.

  • reassign_positions_on_size_change (bool) –

    Whether or not positions should be automatically reassigned if the party

    size changes. Set this to False if you want members to keep their positions unless manually changed. The reassignment is done according to the position priorities. | Defaults to True.

  • joinability (Optional[PartyJoinability]) –

    The joinability configuration that should be used.
    Defaults to PartyJoinability.OPEN

  • discoverability (Optional[PartyDiscoverability]) –

    The discoverability configuration that should be used.
    Defaults to PartyDiscoverability.ALL

  • invite_ttl (Optional[int]) –

    How many seconds the invite should be valid for before

    automatically becoming invalid. | Defaults to 14400

  • intention_ttl (Optional[int]) –

    How many seconds an intention should last.
    Defaults to 60

  • sub_type (Optional[str]) –

    The sub type the party should use.
    Defaults to 'default'

  • party_type (Optional[str]) –

    The type of the party.
    Defaults to 'DEFAULT'

  • cls (Type[ClientParty]) –

    The default party object to use for the client’s party. Here you can

    specify all class objects that inherits from ClientParty.

  • meta (List[functools.partial]) –

    A list of coroutines in the form of partials. This config will be automatically equipped by the party when a new party is created by the client.

    from fortnitepy import ClientParty
    from functools import partial
    
    [
        partial(ClientParty.set_custom_key, 'myawesomekey'),
        partial(ClientParty.set_playlist, 'Playlist_PlaygroundV2', region=fortnitepy.Region.EUROPE)
    ]
    

team_change_allowed

Whether or not players are able to manually swap party team with another player. This setting only works if the client is the leader of the party.

Type

bool

default_squad_assignment

The default squad assignment to use for new members and members not specified in manual squad assignments requests.

Type

SquadAssignment

position_priorities

A list containing exactly 16 integers ranging from 0-16 with no duplicates. This is used for position assignments.

Type

List[int]

reassign_positions_on_size_change

Whether or not positions will be automatically reassigned when the party size changes.

Type

bool

cls

The default party object used to represent the client’s party.

Type

Type[ClientParty]

DefaultPartyMemberConfig

class fortnitepy.DefaultPartyMemberConfig[source]

Data class for the default party member configuration used when the client joins a party.

Parameters
  • cls (Type[ClientPartyMember]) – The default party member object to use to represent the client as a party member. Here you can specify all classes that inherits from ClientPartyMember. The library has two out of the box objects that you can use: - ClientPartyMember (Default) - JustChattingClientPartyMember

  • yield_leadership (bool:) – Wether or not the client should promote another member automatically whenever there is a chance to. Defaults to False

  • offline_ttl (int) – How long the client should stay in the party disconnected state before expiring when the xmpp connection is lost. Defaults to 30.

  • meta (List[functools.partial]) –

    A list of coroutines in the form of partials. This config will be automatically equipped by the bot when joining new parties.

    from fortnitepy import ClientPartyMember
    from functools import partial
    
    [
        partial(ClientPartyMember.set_outfit, 'CID_175_Athena_Commando_M_Celestial'),
        partial(ClientPartyMember.set_banner, icon="OtherBanner28", season_level=100)
    ]
    

cls

The default party member object used when representing the client as a party member.

Type

Type[ClientPartyMember]

yield_leadership

Wether or not the client promotes another member automatically whenever there is a chance to.

Type

bool

offline_ttl

How long the client will stay in the party disconnected state before expiring when the xmpp connection is lost.

Type

int

HTTPRetryConfig

class fortnitepy.HTTPRetryConfig[source]

Config for how HTTPClient should handle retries.

Warning

Messing with these values could potentially make retries spammy. Worst case scenario of this would be that either your ip or your account could be limited due to high traffic. Change these values with caution!

Parameters
  • max_retry_attempts (int) –

    The max amount of retry attempts for a request. Defaults to 5.

    Note

    This is ignored when handling capacity throttling.

  • max_wait_time (Optional[float]) – The max amount of seconds to wait for a request before raising the original exception. This works by keeping track of the total seconds that has been waited for the request regardless of number of attempts. If None this is ignored. Defaults to 65.

  • handle_rate_limits (bool) –

    Whether or not the client should handle rate limit errors and wait the received Retry-After before automatically retrying the request. Defaults to True.

    Note

    This option is only for throttling errors with a Retry-After value.

  • max_retry_after (float) – The max amount of seconds the client should handle. If a throttled error with a higher Retry-After than this value is received, then the original HTTPException is raised instead. Only matters when ``handle_rate_limits`` is ``True``

  • other_requests_wait (bool) – Whether other requests to a rate limited endpoint should wait for the rate limit to disappear before requesting. Defaults to True. Only matters when ``handle_rate_limits`` is ``True``

  • handle_capacity_throttling (bool) – Whether or not the client should automatically handle capacity throttling errors. These occur when the prod server you are requesting from has no available capacity to process a request and therefore returns with a throttle error without a Retry-After. Defaults to True.

  • backoff_start (float) – The initial seconds to wait for the exponential backoff. Defaults to 1. Only matters when ``handle_capacity_throttling`` is ``True``

  • backoff_factor (float) – The multiplying factor used for the exponential backoff when a request fails. Defaults to 1.5. Only matters when ``handle_capacity_throttling`` is ``True``

  • backoff_cap (float) – The cap for the exponential backoff to avoid having unrealistically high wait times. Defaults to 20. Only matters when ``handle_capacity_throttling`` is ``True``

Route

class fortnitepy.Route[source]

Represents a route to use for a http request. This should be subclassed by new routes and the class attributes BASE and optionally AUTH should be overridden.

Warning

Usually there is no reason to subclass and implement routes yourself as most of them are already implemented. Take a look at http.py if you’re interested in knowing all of the predefined routes.

Available authentication placeholders: - IOS_BASIC_TOKEN - FORTNITE_BASIC_TOKEN - IOS_ACCESS_TOKEN - FORTNITE_ACCESS_TOKEN

Example usage:

class SocialBanPublicService(fortnitepy.Route):
    BASE = 'https://social-ban-public-service-prod.ol.epicgames.com'
    AUTH = 'FORTNITE_ACCESS_TOKEN'

route = SocialBanPublicService(
    '/socialban/api/public/v1/{user_id}',
    user_id='c7af4984a77a498b83d8b16d475d76bc'
)
resp = await client.http.get(route)

# resp would look something like this:
# {
#     "bans" : [],
#     "warnings" : []
# }
Parameters
  • path (path) –

    The path to used for the request.

    Warning

    You should always use name formatting for arguments and instead of using `.format()`on the path, you should pass the format kwargs as kwargs to the route. This might seem counterintuitive but it is important to ensure rate limit retry reliability.

  • auth (Optional[str]) – The authentication to use for the request. If None the default auth specified for the route is used.

  • **params (Any) – The variables to format the path with passed alongside their name.

path

The requests path.

Type

str

params

A mapping of the params passed.

Type

Dict[str, Any]

base

The base of the request url.

Type

str

auth

The auth placeholder.

Type

Optional[str]

url

The formatted url.

Type

str

sanitized_url

The yet to be formatted url.

Type

str

Avatar

class fortnitepy.Avatar[source]

Represents a friend’s avatar. This is always related to the outfit the friend has equipped.

namespace

The namespace of the avatar.

Type

str

asset_type

The asset type. This is usually ATHENACHARACTER If the friend has no avatar set, or has a default character set, then this will be None.

Type

Optional[str]

asset

The asset of the avatar. This is usually a CID in full caps. If the friend has no avatar set, or has a default character set, then this will be None.

Type

Optional[str]

SquadAssignment

class fortnitepy.SquadAssignment[source]

Represents a party members squad assignment. A squad assignment is basically a piece of information about which position a member has in the party, which is directly related to party teams.

Parameters
  • position (Optional[int]) – The position a member should have in the party. If no position is passed, a position will be automatically given according to the position priorities set.

  • hidden (bool) –

    Whether or not the member should be hidden in the party.

    Warning

    Being hidden is not a native fortnite feature so be careful when using this. It might lead to undesirable results.

Exceptions

exception fortnitepy.FortniteException[source]

Base exception for fortnitepy.

This could in theory be caught to handle all exceptions thrown by this library.

exception fortnitepy.AuthException(message, original)[source]

This exception is raised when auth fails by invalid credentials passed or some other misc failure.

original

The original exception raised. The original error always inherits from FortniteException.

Type

FortniteException

exception fortnitepy.HTTPException(response, route, message, request_headers)[source]

This exception is raised when an error is received by Fortnite services.

response

The response from the HTTP request.

Type

aiohttp.ClientResponse

text

The error message.

Type

str

status

The status code of the HTTP request.

Type

int

route

The route or url used for this request.

Type

Union[Route, str]

raw

The raw message/data received from Fortnite services.

Type

Union[str, dict]

request_headers

The headers used for the request.

Type

dict

message

The raw error message received from Fortnite services.

Type

str

message_code

The raw error message code received from Fortnite services.

Type

Optional[str]

message_vars

List containing arguments passed to the message.

Type

List[str]

code

The error code received from Fortnite services.

Type

Optional[int]

originating_service

The originating service this error was received from.

Type

Optional[str]

intent

The prod this error was received from.

Type

Optional[str]

validation_failures

A list containing information about the validation failures. None if the error was not raised a validation issue.

Type

Optional[List[ValidationFailure]]

exception fortnitepy.ValidationFailure(data)[source]

Represents a validation failure returned.

field_name

Name of the field that was invalid.

Type

str

invalid_value

The invalid value.

Type

str

message

The message explaining why the field value was invalid.

Type

str

message_code

The raw error message code received.

Type

str

message_vars

The message variables received.

Type

Dict[str, str]

exception fortnitepy.EventError[source]

This exception is raised when something regarding events fails.

exception fortnitepy.XMPPError[source]

This exception is raised when something regarding the XMPP service fails.

exception fortnitepy.PartyError[source]

This exception is raised when something regarding parties fails.

exception fortnitepy.PartyIsFull[source]

This exception is raised when the bot attempts to join a full party.

exception fortnitepy.Forbidden[source]

This exception is raised whenever you attempted a request that your account does not have permission to do.

exception fortnitepy.NotFound[source]

This exception is raised when something was not found by fortnites services.

exception fortnitepy.DuplicateFriendship[source]

This exception is raised whenever the client attempts to add a user as friend when the friendship already exists.

exception fortnitepy.FriendshipRequestAlreadySent[source]

This exception is raised whenever the client attempts to send a friend request to a user that has already received a friend request from the client.

exception fortnitepy.MaxFriendshipsExceeded[source]

This excepttion is raised if the client has hit the limit for friendships.

exception fortnitepy.InviteeMaxFriendshipsExceeded[source]

This exception is raised if the user you attempted to add has hit the limit for friendships.

exception fortnitepy.InviteeMaxFriendshipRequestsExceeded[source]

This exception is raised if the user you attempted to add has hit the limit for the amount of friendship requests a user can have at a time.

exception fortnitepy.FriendOffline[source]

This exception is raised when an action that requires a friend to be online is performed at an offline friend.

exception fortnitepy.InvalidOffer[source]

This exception is raised when an invalid/outdated offer is passed. Only offers currently in the item shop are valid.