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
ifdevice_id
,account_id
andsecret
are present. 2. ByEmailAndPasswordAuth
ifemail
andpassword
is present. If authentication fails because of required captcha, it then attempts to authenticate with the next step. 3.ExchangeCodeAuth
is tried ifexchange_code
is present or ifprompt_exchange_code
isTrue
. 4.AuthorizationCodeAuth
is tried ifauthorization_code
is present or ifprompt_authorization_code
isTrue
.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
andprompt_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
andprompt_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
orprompt_authorization_code
isTrue
.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
orprompt_authorization_code
isTrue
.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¶
- @event()
- add_event_handler()
- get_user()
- is_closed()
- is_ready()
- register_connectors()
- remove_event_handler()
- run()
- awaitaccept_friend()
- awaitadd_friend()
- awaitblock_user()
- awaitclose()
- awaitfetch_active_ltms()
- awaitfetch_avatars()
- awaitfetch_battlepass_level()
- awaitfetch_blocklist()
- awaitfetch_br_news()
- awaitfetch_br_playlists()
- awaitfetch_br_stats()
- awaitfetch_item_shop()
- awaitfetch_leaderboard()
- awaitfetch_lightswitch_status()
- awaitfetch_multiple_battlepass_levels()
- awaitfetch_multiple_br_stats()
- awaitfetch_multiple_br_stats_collections()
- awaitfetch_party()
- awaitfetch_user()
- awaitfetch_user_by_display_name()
- awaitfetch_user_by_email()
- awaitfetch_users()
- awaitfetch_users_by_display_name()
- awaitremove_or_decline_friend()
- awaitrestart()
- awaitsearch_sac_by_slug()
- awaitsearch_users()
- awaitstart()
- awaitunblock_user()
- awaitwait_for()
- awaitwait_until_closed()
- awaitwait_until_ready()
-
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:
Parties (except
BasicClient.fetch_party()
)Friends
Anything related to XMPP (Messaging and most events)
- 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 toWindows/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 cacheUser
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 toTrue
.
-
user
¶ The user the client is logged in as.
- Type
-
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 inevent_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 usestart()
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 clientsaiohttp.ClientSession
when logged out.dispatch_close (
bool
) – Whether or not to dispatch the close event.
- Raises
HTTPException – An error occured while logging out.
-
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 elseFalse
- Return type
-
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
- 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 namecache (
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 otherusers which have display names that start with or match exactly to
Tfue
likeTfue_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
-
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
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 theevent_
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.
-
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 formatevent_<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!')
-
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 Noneend_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
- 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
-
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 Noneend_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 beNone
.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
-
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 Noneend_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 beNone
.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 Noneend_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
-
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 Noneend_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
Forbidden – User has private career board.
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_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 useStatsV2.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
-
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 elseFalse
- Return type
-
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
-
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
-
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¶
- @event()
- add_event_handler()
- get_blocked_user()
- get_friend()
- get_incoming_pending_friend()
- get_outgoing_pending_friend()
- get_pending_friend()
- get_presence()
- get_user()
- has_friend()
- is_blocked()
- is_closed()
- is_pending()
- is_ready()
- register_connectors()
- remove_event_handler()
- run()
- awaitaccept_friend()
- awaitadd_friend()
- awaitblock_user()
- awaitclose()
- awaitfetch_active_ltms()
- awaitfetch_avatars()
- awaitfetch_battlepass_level()
- awaitfetch_blocklist()
- awaitfetch_br_news()
- awaitfetch_br_playlists()
- awaitfetch_br_stats()
- awaitfetch_item_shop()
- awaitfetch_leaderboard()
- awaitfetch_lightswitch_status()
- awaitfetch_multiple_battlepass_levels()
- awaitfetch_multiple_br_stats()
- awaitfetch_multiple_br_stats_collections()
- awaitfetch_party()
- awaitfetch_user()
- awaitfetch_user_by_display_name()
- awaitfetch_user_by_email()
- awaitfetch_users()
- awaitfetch_users_by_display_name()
- awaitjoin_party()
- awaitremove_or_decline_friend()
- awaitrestart()
- awaitsearch_sac_by_slug()
- awaitsearch_users()
- awaitsend_presence()
- awaitset_platform()
- awaitset_presence()
- awaitstart()
- awaitunblock_user()
- awaitwait_for()
- awaitwait_until_closed()
- awaitwait_until_ready()
-
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 toAwayStatus.ONLINE
.platform (
Platform
) – The platform you want the client to display as its source. Defaults toPlatform.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 ofv0.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 to3
(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 toWindows/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 cacheUser
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 toTrue
.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 fromUser
. Keep in mind thatUser.id
always will be available. You can useUser.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 likeevent_party_member_join()
. If this is disabled then member objects in the events won’t have the correct meta. Defaults toTrue
.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. IfDefaultPartyMemberConfig.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
-
party
¶ The party the client is currently connected to.
- Type
-
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 inevent_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.ws_connector (
aiohttp.BaseConnector
) – The connector to use for the websocket xmpp connection.
-
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
oroutgoing
.
-
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
-
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
-
blocked_users
¶ A list of the users client has as blocked.
- Type
List[
BlockedUser
]
-
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
Optional[Union[
IncomingPendingFriend
,OutgoingPendingFriend
]] – The pending friend if found, elseNone
-
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
]
-
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
-
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.
-
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 clientsaiohttp.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 formatevent_<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!')
-
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
-
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 Noneend_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
Forbidden – User has private career board.
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_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
-
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 Noneend_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
- 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
-
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
-
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 useStatsV2.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
-
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 elseFalse
- Return type
-
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 Noneend_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
-
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 Noneend_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 beNone
.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
-
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 Noneend_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 beNone
.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_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 namecache (
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
- Raises
HTTPException – An error occured while requesting the user.
- Returns
A list containing all payloads found for this user.
- Return type
List[
User
]
-
is_ready
()[source]¶ Specifies if the internal state of the client is ready.
- Returns
True
if the internal state is ready elseFalse
- Return type
-
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
-
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 usestart()
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 otherusers which have display names that start with or match exactly to
Tfue
likeTfue_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 theevent_
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
status (
str
) – The status you want to set.away (
AwayStatus
) – The away status to use. Defaults toAwayStatus.ONLINE
.
- 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 instr
or full status indict
.away (
AwayStatus
) – The away status to use. Defaults toAwayStatus.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 withstart_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 to0.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 parameterclient
. 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 ifshutdown_on_error
isTrue
.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 to0.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 parameterclient
. 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 ifshutdown_on_error
isTrue
.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
¶
-
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.
-
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.
-
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 thenevent_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, whileevent_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, whileevent_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
toFalse
inDefaultPartyConfig
.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 beNone
.
-
fortnitepy.
event_party_member_ready_change
(member, before, after)¶ This event is called when a members ready state has changed.
- Parameters
member (
PartyMember
) – The member that changed.before (
ReadyState
) – The previous ready state.after (
ReadyState
) – The current ready status.
-
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.
This event is called when a members banner has been changed.
- Parameters
member (
PartyMember
) – The member that changed.before (
tuple
) – The previous banner data. Same structure asPartyMember.banner
.after (
tuple
) – The current banner data. Same structure asPartyMember.banner
.
-
fortnitepy.
event_party_member_battlepass_info_change
(member, before, after)¶ This event is called when a members battlepass info has been changed.
- Parameters
member (
PartyMember
) – The member that changed.before (
tuple
) – The previous battlepass data. Same structure asPartyMember.battlepass_info
.after (
tuple
) – The current battlepass data. Same structure asPartyMember.battlepass_info
.
-
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 beNone
if not set.after (Optional[
list
]) – The current corruption value. Could beNone
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
member (
PartyMember
) – The member that changed.before (
list
) – The previous outfit variants. Same structure asPartyMember.outfit_variants
.after (
list
) – The current outfit variants. Same structure asPartyMember.outfit_variants
.
-
fortnitepy.
event_party_member_backpack_variants_change
(member, before, after)¶ This event is called when a members backpack variants been changed.
- Parameters
member (
PartyMember
) – The member that changed.before (
list
) – The previous backpack variants. Same structure asPartyMember.backpack_variants
.after (
list
) – The current backpack variants. Same structure asPartyMember.backpack_variants
.
-
fortnitepy.
event_party_member_pickaxe_variants_change
(member, before, after)¶ This event is called when a members pickaxe variants been changed.
- Parameters
member (
PartyMember
) – The member that changed.before (
list
) – The previous pickaxe variants. Same structure asPartyMember.pickaxe_variants
.after (
list
) – The current pickaxe variants. Same structure asPartyMember.pickaxe_variants
.
-
fortnitepy.
event_party_member_contrail_variants_change
(member, before, after)¶ This event is called when a members contrail variants been changed.
- Parameters
member (
PartyMember
) – The member that changed.before (
list
) – The previous contrail variants. Same structure asPartyMember.contrail_variants
.after (
list
) – The current contrail variants. Same structure asPartyMember.contrail_variants
.
-
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¶
- age_group
- can_update_display_name
- client
- country
- display_name
- email_verified
- epicgames_account
- external_auths
- failed_login_attempts
- first_name
- full_name
- headless
- id
- jid
- last_login
- last_name
- minor_expected
- minor_status
- minor_verified
- name
- number_of_display_name_changes
- preferred_language
- tfa_enabled
- awaitfetch()
- awaitfetch_battlepass_level()
- awaitfetch_br_stats()
- awaitfetch_br_stats_collection()
-
class
fortnitepy.
ClientUser
[source]¶ Represents the user the client is connected to.
-
client
¶ The client.
- Type
-
headless
¶ True
if the account has no display name due to no epicgames account being linked to the current account.- Type
-
last_login
¶ UTC time of the last login of the user.
None
if no failed login attempt has been registered.- Type
-
jid
¶ The JID of the client. Includes the resource part.
- Type
-
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
ifClient.fetch_user_data_in_events
is set toFalse
.- 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 ifClient.fetch_user_data_in_events
is set toFalse
.- Type
-
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 toFalse
.- 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 Noneend_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 Noneend_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
-
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 Noneend_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
-
ExternalAuth¶
-
class
fortnitepy.
ExternalAuth
[source]¶ Represents an external auth belonging to a user.
-
client
¶ The client.
- Type
-
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¶
- awaitadd()
- awaitblock()
- awaitfetch()
- awaitfetch_battlepass_level()
- awaitfetch_br_stats()
- awaitfetch_br_stats_collection()
-
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
ifClient.fetch_user_data_in_events
is set toFalse
.- 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 ifClient.fetch_user_data_in_events
is set toFalse
.- Type
-
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 toFalse
.- 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 Noneend_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 Noneend_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
-
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 Noneend_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
-
jid
¶ The JID of the user.
- Type
-
await
BlockedUser¶
- awaitfetch()
- awaitfetch_battlepass_level()
- awaitfetch_br_stats()
- awaitfetch_br_stats_collection()
- awaitunblock()
-
class
fortnitepy.
BlockedUser
[source]¶ Represents a blocked user from Fortnite
-
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
ifClient.fetch_user_data_in_events
is set toFalse
.- 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 ifClient.fetch_user_data_in_events
is set toFalse
.- Type
-
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 toFalse
.- 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 Noneend_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 Noneend_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
-
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 Noneend_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
-
jid
¶ The JID of the user.
- Type
-
UserSearchEntry¶
- awaitadd()
- awaitblock()
- awaitfetch()
- awaitfetch_battlepass_level()
- awaitfetch_br_stats()
- awaitfetch_br_stats_collection()
-
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 matchedand 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
ifClient.fetch_user_data_in_events
is set toFalse
.- 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 ifClient.fetch_user_data_in_events
is set toFalse
.- Type
-
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 toFalse
.- 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 Noneend_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 Noneend_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
-
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 Noneend_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
-
jid
¶ The JID of the user.
- Type
SacSearchEntryUser¶
- awaitadd()
- awaitblock()
- awaitfetch()
- awaitfetch_battlepass_level()
- awaitfetch_br_stats()
- awaitfetch_br_stats_collection()
-
class
fortnitepy.
SacSearchEntryUser
[source]¶ Represents a user entry in a support a creator code search.
- Parameters
-
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
ifClient.fetch_user_data_in_events
is set toFalse
.- 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 ifClient.fetch_user_data_in_events
is set toFalse
.- Type
-
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 toFalse
.- 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 Noneend_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 Noneend_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
-
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 Noneend_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
-
jid
¶ The JID of the user.
- Type
Friend¶
- is_online()
- awaitblock()
- awaitfetch()
- awaitfetch_avatar()
- awaitfetch_battlepass_level()
- awaitfetch_br_stats()
- awaitfetch_br_stats_collection()
- awaitfetch_last_logout()
- awaitfetch_mutual_friends()
- awaitinvite()
- awaitjoin_party()
- awaitowns_offer()
- awaitremove()
- awaitremove_nickname()
- awaitremove_note()
- awaitrequest_to_join()
- awaitsend()
- awaitset_nickname()
- awaitset_note()
- awaitwait_until_offline()
- awaitwait_until_online()
-
class
fortnitepy.
Friend
[source]¶ Represents a friend on Fortnite
-
favorite
¶ True
if the friend is favorited byClientUser
elseFalse
.- Type
-
last_presence
¶ The last presence retrieved by the friend. Might be
None
if no presence has been received by this friend yet.- Type
-
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 withFriend.fetch_last_logout()
.- Type
-
platform
¶ The platform the friend is currently online on.
None
if the friend is offline.- Type
-
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 useClient.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 elseFalse
.- Return type
-
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
-
await
invite
()[source]¶ This function is a coroutine.
Invites this friend to your party.
- Raises
PartyError – Friend is already in your party.
PartyError – The party is full.
HTTPException – Something went wrong when trying to invite this friend.
- Returns
Object representing the sent party invitation.
- Return type
-
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
PartyError – You are already a part of this friends party.
FriendOffline – The friend you requested to join is offline.
HTTPException – An error occured while requesting.
-
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
-
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
-
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
-
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
ifClient.fetch_user_data_in_events
is set toFalse
.- 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 ifClient.fetch_user_data_in_events
is set toFalse
.- Type
-
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 toFalse
.- 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 Noneend_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 Noneend_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
-
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 Noneend_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
-
inbound
¶ True
if this friend was the one to send the friend request elseFalse`. Aliased to ``inbound
as well.- Type
-
incoming
¶ True
if this friend was the one to send the friend request elseFalse`. Aliased to ``inbound
as well.- Type
-
jid
¶ The JID of the user.
- Type
-
outbound
¶ True
if the bot was the one to send the friend request elseFalse
. Aliased tooutbound
as well.- Type
-
outgoing
¶ True
if the bot was the one to send the friend request elseFalse
. Aliased tooutbound
as well.- Type
-
IncomingPendingFriend¶
- awaitaccept()
- awaitblock()
- awaitdecline()
- awaitfetch()
- awaitfetch_battlepass_level()
- awaitfetch_br_stats()
- awaitfetch_br_stats_collection()
-
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
-
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
-
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
ifClient.fetch_user_data_in_events
is set toFalse
.- 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 ifClient.fetch_user_data_in_events
is set toFalse
.- Type
-
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 toFalse
.- 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 Noneend_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 Noneend_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
-
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 Noneend_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
-
inbound
¶ True
if this friend was the one to send the friend request elseFalse`. Aliased to ``inbound
as well.- Type
-
incoming
¶ True
if this friend was the one to send the friend request elseFalse`. Aliased to ``inbound
as well.- Type
-
jid
¶ The JID of the user.
- Type
-
outbound
¶ True
if the bot was the one to send the friend request elseFalse
. Aliased tooutbound
as well.- Type
-
outgoing
¶ True
if the bot was the one to send the friend request elseFalse
. Aliased tooutbound
as well.- Type
-
await
OutgoingPendingFriend¶
- awaitabort()
- awaitblock()
- awaitcancel()
- awaitfetch()
- awaitfetch_battlepass_level()
- awaitfetch_br_stats()
- awaitfetch_br_stats_collection()
-
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
-
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
ifClient.fetch_user_data_in_events
is set toFalse
.- 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 ifClient.fetch_user_data_in_events
is set toFalse
.- Type
-
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 toFalse
.- 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 Noneend_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 Noneend_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
-
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 Noneend_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
-
inbound
¶ True
if this friend was the one to send the friend request elseFalse`. Aliased to ``inbound
as well.- Type
-
incoming
¶ True
if this friend was the one to send the friend request elseFalse`. Aliased to ``inbound
as well.- Type
-
jid
¶ The JID of the user.
- Type
-
outbound
¶ True
if the bot was the one to send the friend request elseFalse
. Aliased tooutbound
as well.- Type
-
outgoing
¶ True
if the bot was the one to send the friend request elseFalse
. Aliased tooutbound
as well.- Type
-
await
FriendMessage¶
- awaitreply()
-
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
The author of the message.
- Type
-
created_at
¶ The time of when this message was received in UTC.
- Type
-
await
PartyMessage¶
- awaitreply()
PartyMember¶
- assisted_challenge
- backpack
- backpack_variants
- banner
- battlepass_info
- client
- contrail
- contrail_variants
- corruption
- display_name
- emoji
- emote
- enlightenments
- epicgames_account
- external_auths
- hidden
- id
- input
- jid
- joined_at
- leader
- lobby_map_marker_coordinates
- match_players_left
- match_started_at
- offline_ttl
- outfit
- outfit_variants
- party
- pet
- pickaxe
- pickaxe_variants
- platform
- position
- ready
- will_yield_leadership
- zombie_since
- create_variant()
- create_variants()
- in_match()
- is_chatbanned()
- is_just_chatting()
- is_ready()
- is_zombie()
- lobby_map_marker_is_visible()
- awaitadd()
- awaitblock()
- awaitchatban()
- awaitfetch()
- awaitfetch_battlepass_level()
- awaitfetch_br_stats()
- awaitfetch_br_stats_collection()
- awaitkick()
- awaitpromote()
- awaitswap_position()
-
class
fortnitepy.
PartyMember
[source]¶ Represents a party member.
-
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
Forbidden – You are not the leader of the party.
ValueError – This user is already banned.
NotFound – The user was not found.
-
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
-
backpack
¶ The BID of the backpack this member currently has equipped.
None
if no backpack is equipped.- Type
-
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 toClientPartyMember.set_backpack()
.- Type
A tuple consisting of the icon id, color id and the season level.
Example output:
('standardbanner15', 'defaultcolor15', 50)
- Type
-
battlepass_info
¶ A tuple consisting of has purchased, battlepass level, self boost xp, friends boost xp.
Example output:
(True, 30, 80, 70)
- Type
-
await
block
()[source]¶ This function is a coroutine.
Blocks this user.
- Raises
HTTPException – Something went wrong while blocking this user.
-
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 toClientPartyMember.set_contrail()
.- Type
-
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 beProfileBanner
.
- 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 beProfileBanner
.
- 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
ifClient.fetch_user_data_in_events
is set toFalse
.- 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
]
-
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 ifClient.fetch_user_data_in_events
is set toFalse
.- Type
-
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 toFalse
.- 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 Noneend_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 Noneend_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
-
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 Noneend_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
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
-
in_match
()[source]¶ Whether or not this member is currently in a match.
- Returns
True
if this member is in a match elseFalse
.- Return type
-
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 elseFalse
.- Return type
-
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
-
joined_at
¶ The UTC time of when this member joined its party.
- Type
-
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
-
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 elseFalse
.- Return type
-
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
-
match_started_at
¶ The time in UTC that the members match started.
None
if not in a match.- Type
Optional[
datetime.datetime
]
-
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 toClientPartyMember.set_outfit()
.- Type
-
party
¶ The party this member is a part of.
- Type
Union[
Party
,ClientParty
]
-
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 toClientPartyMember.set_pickaxe()
.- Type
-
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 14-7 = Team 28-11 = Team 312-15 = Team 4- Type
-
ready
¶ The members ready state.
- Type
-
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
-
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
]
-
await
ClientPartyMember¶
- assisted_challenge
- backpack
- backpack_variants
- banner
- battlepass_info
- client
- contrail
- contrail_variants
- corruption
- display_name
- emoji
- emote
- enlightenments
- epicgames_account
- external_auths
- hidden
- id
- input
- jid
- joined_at
- leader
- lobby_map_marker_coordinates
- match_players_left
- match_started_at
- offline_ttl
- outfit
- outfit_variants
- party
- pet
- pickaxe
- pickaxe_variants
- platform
- position
- ready
- will_yield_leadership
- zombie_since
- create_variant()
- create_variants()
- in_match()
- is_chatbanned()
- is_just_chatting()
- is_ready()
- is_zombie()
- lobby_map_marker_is_visible()
- awaitadd()
- awaitblock()
- awaitclear_assisted_challenge()
- awaitclear_backpack()
- awaitclear_contrail()
- awaitclear_emote()
- awaitclear_in_match()
- awaitclear_lobby_map_marker()
- awaitclear_pet()
- awaitedit()
- awaitedit_and_keep()
- awaitfetch()
- awaitfetch_battlepass_level()
- awaitfetch_br_stats()
- awaitfetch_br_stats_collection()
- awaitleave()
- awaitset_assisted_challenge()
- awaitset_backpack()
- awaitset_banner()
- awaitset_battlepass_info()
- awaitset_contrail()
- awaitset_emoji()
- awaitset_emote()
- awaitset_in_match()
- awaitset_lobby_map_marker()
- awaitset_outfit()
- awaitset_pet()
- awaitset_pickaxe()
- awaitset_position()
- awaitset_ready()
-
class
fortnitepy.
ClientPartyMember
[source]¶ Represents the clients party member.
-
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. UnlikeClientPartyMember.edit()
, this method only takes coroutines in the form of afunctools.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
-
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 toNone
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 toNone
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 toNone
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 toNone
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 toNone
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 withPartyMember.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 withPartyMember.clear_emote()
. Defaults to2
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 whenPartyMember.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.
This function is a coroutine.
Sets the banner of the client.
- Parameters
- 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 Falselevel (Optional[
int
]) – Sets the level and shows it visually. Defaults to 1self_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
- 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
ValueError – The passed position is out of bounds.
HTTPException – An error occured while requesting.
-
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
- 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
-
backpack
¶ The BID of the backpack this member currently has equipped.
None
if no backpack is equipped.- Type
-
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 toClientPartyMember.set_backpack()
.- Type
A tuple consisting of the icon id, color id and the season level.
Example output:
('standardbanner15', 'defaultcolor15', 50)
- Type
-
battlepass_info
¶ A tuple consisting of has purchased, battlepass level, self boost xp, friends boost xp.
Example output:
(True, 30, 80, 70)
- Type
-
await
block
()[source]¶ This function is a coroutine.
Blocks this user.
- Raises
HTTPException – Something went wrong while blocking this user.
-
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 toClientPartyMember.set_contrail()
.- Type
-
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 beProfileBanner
.
- 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 beProfileBanner
.
- 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
ifClient.fetch_user_data_in_events
is set toFalse
.- 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
]
-
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 ifClient.fetch_user_data_in_events
is set toFalse
.- Type
-
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 toFalse
.- 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 Noneend_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 Noneend_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
-
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 Noneend_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
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
-
in_match
()[source]¶ Whether or not this member is currently in a match.
- Returns
True
if this member is in a match elseFalse
.- Return type
-
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 elseFalse
.- Return type
-
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
-
joined_at
¶ The UTC time of when this member joined its party.
- Type
-
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
-
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 elseFalse
.- Return type
-
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
-
match_started_at
¶ The time in UTC that the members match started.
None
if not in a match.- Type
Optional[
datetime.datetime
]
-
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 toClientPartyMember.set_outfit()
.- Type
-
party
¶ The party this member is a part of.
- Type
Union[
Party
,ClientParty
]
-
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 toClientPartyMember.set_pickaxe()
.- Type
-
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 14-7 = Team 28-11 = Team 312-15 = Team 4- Type
-
ready
¶ The members ready state.
- Type
-
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
-
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
]
-
await
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¶
- get_member()
- awaitjoin()
-
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
-
get_member
(user_id)[source]¶ Optional[
PartyMember
]: Attempts to get a party member from the member cache. ReturnsNone
if no user was found by the user id.
-
leader
¶ The leader of the party.
- Type
-
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
-
privacy
¶ The currently set privacy of this party.
- Type
-
squad_assignments
¶ The squad assignments for this party. This includes information about a members position and visibility.
- Type
Dict[
PartyMember
,SquadAssignment
]
-
await
ClientParty¶
- get_member()
- awaitedit()
- awaitedit_and_keep()
- awaitfetch_invites()
- awaitinvite()
- awaitsend()
- awaitset_custom_key()
- awaitset_fill()
- awaitset_max_size()
- awaitset_playlist()
- awaitset_privacy()
- awaitset_squad_assignments()
-
class
fortnitepy.
ClientParty
[source]¶ Represents ClientUser’s party.
-
me
¶ The clients partymember object.
- Type
-
muc_jid
¶ The JID of the party MUC.
- Type
-
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. UnlikeClientParty.edit()
, this method only takes coroutines in the form of afunctools.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
-
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
withSolo
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 toRegion.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_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.
-
get_member
(user_id)[source]¶ Optional[
PartyMember
]: Attempts to get a party member from the member cache. ReturnsNone
if no user was found by the user id.
-
leader
¶ The leader of the party.
- Type
-
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
-
privacy
¶ The currently set privacy of this party.
- Type
-
squad_assignments
¶ The squad assignments for this party. This includes information about a members position and visibility.
- Type
Dict[
PartyMember
,SquadAssignment
]
-
ReceivedPartyInvitation¶
-
class
fortnitepy.
ReceivedPartyInvitation
[source]¶ Represents a received party invitation.
-
created_at
¶ The UTC time this invite was created at.
- Type
-
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
-
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¶
-
class
fortnitepy.
SentPartyInvitation
[source]¶ Represents a sent party invitation.
-
sender
¶ The party member that sent the invite.
- Type
-
created_at
¶ The UTC time this invite was created at.
- Type
-
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¶
-
class
fortnitepy.
PartyJoinConfirmation
[source]¶ Represents a join confirmation.
-
party
¶ The party the user wants to join.
- Type
-
created_at
¶ The UTC time of when the join confirmation was received.
- Type
-
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¶
- awaitaccept()
-
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.
-
party
¶ The party the user wants to join.
- Type
-
created_at
¶ The UTC timestamp of when this join request was created.
- Type
-
expires_at
¶ The UTC timestamp of when this join request will expire. This should always be one minute after its creation.
- Type
-
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
PartyError – User is already in your party.
PartyError – The party is full.
HTTPException – An error occured while requesting.
-
Presence¶
-
class
fortnitepy.
Presence
[source]¶ Represents a presence received from a friend
-
available
¶ Whether or not the user is online.
True
if the friend is or went online,False
if the friend went offline.- Type
-
away
¶ The users away status.
- Type
-
received_at
¶ The UTC time of when the client received this presence.
- Type
-
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
-
has_properties
¶ True
if the presence has properties elseFalse
.Warning
All attributes below this point will be
None
ifhas_properties
isFalse
.- Type
-
party
¶ The friend’s party.
- Type
-
gameplay_stats
¶ The friend’s gameplay stats. Will be
None
if no gameplay stats are currently availble.- Type
Optional[
PresenceGameplayStats
]
-
PresenceParty¶
- awaitjoin()
-
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
.-
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
-
await
PresenceGameplayStats¶
-
class
fortnitepy.
PresenceGameplayStats
[source]¶ Represents gameplaystats received from presence.
-
state
¶ The state.
Note
It’s not really known what value this property might hold. This is pretty much always an empty string.
- Type
-
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
-
kills
¶ The amount of kills the friend currently has. Aliased to
num_kills
as well for legacy reasons.- Type
-
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'])
-
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'])
-
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
-
get_combined_stats
(platforms=True)[source]¶ Gets combined stats for this user.
- Parameters
platforms (
bool
) –True
if the combined stats should be mapped to theirrespective 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
-
StatsCollection¶
BattleRoyaleNewsPost¶
Store¶
-
class
fortnitepy.
Store
[source]¶ Object representing store data from Fortnite Battle Royale.
-
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
]
-
special_featured_items
¶ 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
-
created_at
¶ The UTC time of the creation and current day.
- Type
-
expires_at
¶ The UTC time of when this item shop expires.
- Type
-
FeaturedStoreItem¶
-
class
fortnitepy.
FeaturedStoreItem
[source]¶ Featured store item.
-
asset
¶ The asset of the item. Usually a CID or or something similar. Could be
None
if not found.- Type
-
encryption_key
¶ The encryption key for this item. If no encryption key is found, this will be
None
.- Type
-
grants
¶ A list of items you get from this purchase.
Typical output:
[{ 'quantity': 1, 'type': 'AthenaCharacter', 'asset': 'cid_318_athena_commando_m_demon' }]
- Type
-
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
-
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
-
encryption_key
¶ The encryption key for this item. If no encryption key is found, this will be
None
.- Type
-
grants
¶ A list of items you get from this purchase.
Typical output:
[{ 'quantity': 1, 'type': 'AthenaCharacter', 'asset': 'cid_318_athena_commando_m_demon' }]
- Type
-
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
-
Playlist¶
-
class
fortnitepy.
Playlist
[source]¶ -
-
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
]
-
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 valuebetween 1 and 16. | Defaults to
16
chat_enabled (Optional[
bool
]) –Wether or not the party chat should be enabled for the party.Defaults toTrue
.team_change_allowed (
bool
) –Whether or not players should be able to manually swap party teamwith 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 assignmentsholds 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 memberjoins 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 partysize 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 toTrue
.joinability (Optional[
PartyJoinability
]) –The joinability configuration that should be used.Defaults toPartyJoinability.OPEN
discoverability (Optional[
PartyDiscoverability
]) –The discoverability configuration that should be used.Defaults toPartyDiscoverability.ALL
invite_ttl (Optional[
int
]) –How many seconds the invite should be valid for beforeautomatically becoming invalid. | Defaults to
14400
intention_ttl (Optional[
int
]) –How many seconds an intention should last.Defaults to60
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 canspecify 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
-
default_squad_assignment
¶ The default squad assignment to use for new members and members not specified in manual squad assignments requests.
- Type
-
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
-
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 fromClientPartyMember
. 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 toFalse
offline_ttl (
int
) – How long the client should stay in the party disconnected state before expiring when the xmpp connection is lost. Defaults to30
.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
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. IfNone
this is ignored. Defaults to65
.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 toTrue
.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 originalHTTPException
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 toTrue
. 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 toTrue
.backoff_start (
float
) – The initial seconds to wait for the exponential backoff. Defaults to1
. Only matters when ``handle_capacity_throttling`` is ``True``backoff_factor (
float
) – The multiplying factor used for the exponential backoff when a request fails. Defaults to1.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 to20
. 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 optionallyAUTH
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. IfNone
the default auth specified for the route is used.**params (Any) – The variables to format the path with passed alongside their name.
Avatar¶
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
-
-
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.
-
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.
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.