Frequently Asked Questions (FAQ)

Authentication

Why are there so many different authentication methods?

With the introduction of captcha on email and password authentication, there was a need of different ways to authenticate. Therefore, fortnitepy tries to offer as many different authentication methods as possible. You can read more about the different possibilities over here.

Which authentication method should I use?

The answer to this question depends completely on what information you already have, but it usually comes down to AdvancedAuth no matter what. It’s simply the best right now as it combines other authentication methods and handles all of the annoying stuff like creating device auths etc. If you are unsure how to use AdvancedAuth, you can take a look at the examples folder where it’s used in all of the examples.

Whats the best way of storing the device auth details of an account?

This depends on the complexity of the bot with multiple accounts in mind. For a program running a single bot, the easiest method of storage would be using a json file. A method for this is showcased in all examples.

For bots with multiple accounts I suggest using a database for the single reason that file io is blocking and sometimes the operating system might spit out errors because too many files are opened at the same time.

Note: If you’re going to use a database for anything in the same program as the fortnite bot, please use an asynchronous database library. I can personally recommend using a postgresql database and asyncpg as the library.

General

What is async/await and how do I use it?

Asynchronous programming lets the program sort of perform multiple actions at once. For newcomers to python/programming in general, the discord.py faq has a great simplified explanation of its basic concepts. For people with existing knowledge of asynchronous programming that want to know even more about it, I can suggest this article on it. As well as breakign down pretty much all you need to know about asynchronous programming, it also explains the differences between multiprocessing, threading and asyncio in python in an understandable way.

Where can I find usage examples?

You can find example code in the examples folder in the github repository.

How can I access the clients current party object?

The clients current party object can be accessed through Client.party.

How can I access the clients current party member object?

The clients current party member object can be accessed through ClientParty.me. Example usage: await client.party.me.set_emote('EID_Floss')

How can I send a DM?

To send a DM you first need the Friend object of the friend you want to send the dm to and then use Friend.send(). Example:

friend = client.get_friend('7e9f8dd37a924496bc5083733887b44c')
await friend.send('Hello friend!')

If you want to respond to a friend message in event_friend_message(), you can do this by using FriendMessage.reply(). Example:

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

    # Not as clean but would still work:
    await message.author.send('Thanks for the message!')

How can I set a status?

You can pass a status message for the client to use when creating client.

client = fortnitepy.Client(
    auth=fortnitepy.Auth, // Here goes an authentication method like fortnitepy.AdvancedAuth or fortnitepy.EmailAndPasswordAuth
    status="This is my status"
)

Warning

This will override all status messages in the future. The standard status message (Battle Royale Lobby {party size} / {party max size}) will also be overridden. If you just want to send a status message once and not override all upcoming status messages, Client.send_presence() is the function you are looking for.

Alternatively you can change the presence with Client.set_presence().

How can I get the CID of a skin?

There is no good easy way to obtain these yourself. However, some great minds have created tools to make this easier for others. Here are some of them: - FunGames’ API. - NotOfficer’s API.

How can I use Two Factor Authentication when logging into the client?

If the user the client attempts to log in as requires two factor authentication, the code will be prompted in console on startup. Then just type it into console and if accepted, the login process will continue.

Alternatively, you might pass the code when intitializing Client with the keyword two_factor_code.

How can I get a users K/D or Win Percentage?

Since the stats request does not return a K/D or win percentage, you must calculate them yourself. Just to make it easy StatsV2 includes functions that calculates these values for you.

Take a closer look at StatsV2.get_kd() and StatsV2.get_winpercentage().

How can I fix the “Incompatible net_cl” error?

Note

Since fortnitepy v0.9.0 net_cl is not needed and this error will therefore not be an issue. For legacy and possibly future use, it will remain in the faq.

When fortnite releases a new content update they also update a specific number named netcl needed for the party service to work. When updating this lib I also update the net_cl to match the new one. However, since fortnite seems to update their game every week I sometimes don’t keep up and you have to find and initialize the client with the correct one yourself.

Guide to find netcl:

  1. Navigate to the folder where you find your fortnite logs. Usually something like this: C:\Users\%your_user%\AppData\Local\FortniteGame\Saved\Logs.

  2. Go into the latest log file (Typically named FortniteGame).

  3. Press ctrl + f and do a search for netcl. You should then find a seven digit number.

This is how you launch the client with the manual netcl:

# pass the netcl to with the net_cl keyword when initializing the client.
client = fortnitepy.Client(
    auth=fortnitepy.Auth, // Here goes an authentication method like fortnitepy.AdvancedAuth or fortnitepy.EmailAndPasswordAuth
    net_cl='7605985'
)