Giter VIP home page Giter VIP logo

fortnitepy's People

Contributors

luc1412 avatar realcyguy avatar terbau avatar thisnils avatar xmistt avatar zw5 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

fortnitepy's Issues

xmpp event return array

seems that something on an FriendRequest returns an array:

getting the following error:
TypeError list indices must be integers or slices, not str

Add Support for EpicGames News (Blog Entries)

Endpoint: https://www.epicgames.com/fortnite/api/blog/getPosts

How you can change the language? (found no better way)

send get requests as long response['blogList'][0]['locale'] has the requested language

Languages:
English (America): en-US
Russian: ru
Arabic: ar
Portuegese (Brasil): pt-BR
Spanish (Mexico): es-MX
Spanish (Spain): es-ES
Turkey: tr
French: fr
German: de
Italian: it
Japanese: ja
Korean: ko
Chinese (Singapore): zh-CN

Can you help me?

Can you help me to change skins with cid im not really a pro in python. when i make the command in my python file then the file wont start.

ConnectionError: connection timeout

Getting the following error

broker task failed
Traceback (most recent call last):
File "/usr/local/lib/python3.7/dist-packages/aioxmpp/stream.py", line 1939, in _run
timeout=timeout)
File "/usr/lib/python3.7/asyncio/tasks.py", line 363, in wait
return await _wait(fs, timeout, return_when, loop)
File "/usr/lib/python3.7/asyncio/tasks.py", line 456, in _wait
await waiter
concurrent.futures._base.CancelledError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/local/lib/python3.7/dist-packages/aioxmpp/stream.py", line 892, in _done_handler
task.result()
File "/usr/local/lib/python3.7/dist-packages/aioxmpp/stream.py", line 1987, in _run
raise self._xmlstream_exception
ConnectionError: connection timeout (dead time hard limit exceeded)
stream failed: connection timeout (dead time hard limit exceeded)

Improve Stats + add Stats V1

Stats V1:
def get_stats(account_id, timewindow)

Endpoint: https://fortnite-public-service-prod11.ol.epicgames.com/fortnite/api/stats/accountId/{account_id}/bulk/window/{timewindow}
If response.status =! 200 or response.json == {}:
Account is private

How the stats Dict look like:
platform_stats_entry = stats[Platform.PLATFORM(eg. PC)]

class PlatformStatsEntry
stats_entry = platform_stats_entry.solo (p2)
platform_stats_entry.duo (p10)
platform_stats_entry.squad (p9)
platform_stats_entry.all (p2 + p9 +p10)

class StatsEntry
stats_entry.wins (placetop1)
stats_entry.top3 (placetop3)
stats_entry.top5 (placetop5)
stats_entry.top6 (placetop6)
stats_entry.top10 (placetop10)
stats_entry.top12 (placetop12)
stats_entry.top25 (placetop25)
stats_entry.matches_played (matchesplayed)
stats_entry.kills (kills)
stats_entry.score (score)
stats_entry.minutes_played (minutesplayed)
stats_entry.last_modified (lastmodified)
stats_entry.top3 (placetop3)
stats_entry.kills_per_game (kills / matches)
stats_entry.score_per_gam3 (score / matches)
stats_entry.win_ratio (wins / matches * 100)
stats_entry.deaths (games - wins)
stats_entry.kd (kills / deaths)

Platform Enum:
PC = 'pc'
XBOX = 'xb1'
PLAYSTATION = 'ps4'

StatsV2 improvements:

  • Add Predefined Start/End Time -> Seasonal Stats
    If response.status =! 200 or response.json == {}:
    Account is private

input_stats_entry = stats[Input.INPUT_TYPE(eg. TOUCH)]

class InputStatsEntry:
input_stats_entry.solo (defaultsolo)
input_stats_entry.duo (defaultsquad)
input_stats_entry.squad (defaultsquad)
input_stats_entry.ltm[{ltm_name}
input_stats_entry.solo_all (defaultsolo + all ltm .startswith(solo) + Carmine ltm)
input_stats_entry.duo_all (defaultsolo + all ltm .startswith(solo))
input_stats_entry.squad_all (defaultsolo + all ltm .startswith(solo))

input_stats_entry.all
input_stats_entry.all_all

classStatsEntry:
similar to V1 only some placetop are missing

Platform InputType:
KEYBOARDMOUSE = 'keyboardmouse'
CONTROLLER = 'gamepad'
TOUCH = 'touch'

Bug when fetching BPLvl from a private account

When I try to use client.fetch_battlepass_level() from an account which is set to Private I get an internal error instead of Forbidden

Error:

raceback (most recent call last):
  File "/red32/lib/python3.8/site-packages/redbot/core/dev_commands.py", line 192, in _eval
    result = await func()
  File "<string>", line 4, in func
  File "/bot-configs/bot2/cogs/Downloader/lib/fortnitepy/client.py", line 2151, in fetch_battlepass_level
    return data[user_id]
KeyError: '369644c6224d4845aa2b00e63b60241d'
 

Add Download function for GameFiles

It would be nice to have a function to download the gamefiles. Waddlesworth has already published how it works in JS:

chunk_hash.js

function toHex(d)
{
    return ("0"+(Number(d).toString(16))).slice(-2).toUpperCase();
}

function FString_ToBlobUInt64(str)
{
    //if (8 < (str.length / 3) || str.length % 3 != 0)
    if (str.length % 3 != 0)
    {
        return null;
    }

    let hexString = "";
    for (let i = 0; i < str.length; i += 3)
    {
        const numStr = str[i] + str[i+1] + str[i+2];
        const val = parseInt(numStr);
        hexString = toHex(val) + hexString;
    }

    return hexString;
}

function FString_ToBlobUInt32(str) {
    if (4 < (str.length / 3) || str.length % 3 != 0)
    {
        return null;
    }

    var numbers = []
    for (let i = 0; i < str.length; i += 3)
    {
        const numStr = str[i] + str[i+1] + str[i+2];
        const val = parseInt(numStr);
        numbers.push(val);
    }

    var buffer = new Uint8Array(numbers);
    var uint32 = new Uint32Array(buffer.buffer);
    return uint32[0];
}

//console.log(FString_ToBlobUInt32('000000016000'));

exports.FString_ToBlobUInt64 = FString_ToBlobUInt64;
exports.FString_ToBlobUInt32 = FString_ToBlobUInt32;

//console.log(FString_ToBlobUInt64("235224080183233192061046"));

download.js

const fs = require('fs');
const fetch = require('node-fetch');
const zlib = require('zlib');
const crypto = require('crypto');
const {FString_ToBlobUInt64, FString_ToBlobUInt32} = require('./chunk_hash');

const distribution = 'https://epicgames-download1.akamaized.net/';
const fortniteDL = 'Builds/Fortnite/CloudDir/ChunksV3/';

function GetManifest(token) {
    return fetch("https://launcher-public-service-prod06.ol.epicgames.com/launcher/api/public/assets/Windows/4fe75bbc5a674f4f9b356b5c90567da5/Fortnite?label=Live", {
        method: 'GET',
        headers: {
            'Authorization': 'bearer ' + token,
        },
    }).then(r => r.json()).then(v => {
        fs.writeFileSync("./downloader/manifest.json", JSON.stringify(v));
        return v;
    });
}

exports.GetManifest = GetManifest;

function GetChunkManifest(manifest) {
    var url = distribution + manifest.items.MANIFEST.path;
    return fetch(url, {
        method: 'GET',
    }).then(r => r.json()).then(v => {
        fs.writeFileSync("./downloader/chunk_manifest.json", JSON.stringify(v));
        return v;
    });
}

exports.GetChunkManifest = GetChunkManifest;

function GetFileURLs(manifest, file) {
    return file.FileChunkParts.map(v => {
        var chunkHash = FString_ToBlobUInt64(manifest.ChunkHashList[v.Guid]);
        var dataGroup = manifest.DataGroupList[v.Guid].slice(-2);
        return {
            guid: v.Guid,
            url: distribution + fortniteDL + dataGroup + '/' + chunkHash + '_' + v.Guid + '.chunk',
            offset: FString_ToBlobUInt32(v.Offset),
            size: FString_ToBlobUInt32(v.Size),
            hash: chunkHash,
        };
    });
}

function ParseChunkHeader(data, fileData) {
    var reader = new DataReader(data, fileData);
    var magic = reader.readUInt32LE();
    var chunkVersion = reader.readUInt32LE();
    var headerSize = reader.readUInt32LE();
    var dataSize = reader.readUInt32LE();
    var guid = new FGuid(reader);
    var rollingHash = reader.readInt64LE();
    var storedAs = reader.readUInt8();
    var shaHash = reader.readData(20);
    var hashType = reader.readUInt8();


    var result = Buffer.allocUnsafe(dataSize);
    data.copy(result, 0, headerSize, headerSize + dataSize);

    if (storedAs & 0x01) { // Compressed
        var decomData = zlib.inflateSync(result);
        var selectedFile = Buffer.allocUnsafe(fileData.size);
        decomData.copy(selectedFile, 0, fileData.offset, fileData.offset + fileData.size);
        result = selectedFile;
    }

    if (hashType & 0x02) { // Sha1
        const hash = crypto.createHash('sha1');
        hash.update(result);
        // console.log([hash.digest('hex'), fileData.hash, shaHash]);
    }

    if (hashType & 0x01) { // RollingPoly64
        //console.log('rolling poly');
    }

    return result;
}

async function DownloadChunkFile(manifest, file, progress) {
    var fileUrls = GetFileURLs(manifest, file);
    var filename = file.Filename.split('/').pop();
    var fd = fs.openSync('./paks/' + filename, 'a');
    for (var i=0; i < fileUrls.length; i++) {
        var buf = false;
        var chunkPath = './chunks/' + fileUrls[i].hash + '_' + fileUrls[i].guid + '.chunk';
        if (fs.existsSync(chunkPath)) {
            buf = fs.readFileSync(chunkPath);
        } else {
            var req = await fetch(fileUrls[i].url, {
                method: 'GET',
                headers: {
                    'Accept-Encoding': 'br, gzip, deflate',
                }
            });
            var buf = await req.buffer();
            fs.writeFileSync(chunkPath, buf);
        }
        progress(i, fileUrls.length);
        var resBuf = ParseChunkHeader(buf, fileUrls[i]);
        fs.writeSync(fd, resBuf);
    }
    fs.closeSync(fd);
    return filename;
}

exports.DownloadChunkFile = DownloadChunkFile;

class DataReader {
    constructor(data, context) {
        this.data = data;
        this.context = context;
        this.offset = 0;
    }
    readInt32LE() {
        const result = this.data.readInt32LE(this.offset);
        this.offset += 4;
        return result;
    }
    readUInt32LE() {
        const result = this.data.readUInt32LE(this.offset);
        this.offset += 4;
        return result;
    }
    readUInt16LE() {
        const result = this.data.readUInt16LE(this.offset);
        this.offset += 2;
        return result;
    }
    readInt64LE() {
        const result = this.data.readIntLE(this.offset, 6);
        this.offset += 8;
        return result;
    }
    readData(bytes) {
        const result = this.data.slice(this.offset, this.offset + bytes);
        this.offset += bytes;
        return result;
    }
    readString(length) {
        let result = this.data.toString('utf8', this.offset, this.offset + length);
        this.offset += length;
        if (length > 0) {
            result = result.slice(0, -1);
        }
        return result;
    }
    readWString(length) {
        let result = this.data.toString('utf16le', this.offset, this.offset + length * 2);
        this.offset += length * 2;
        if (length > 0) {
            result = result.slice(0, -1);
        }
        return result;
    }
    readBool() {
        const result = this.data.readInt8(this.offset);
        this.offset += 1;
        return result === 1 ? true : false;
    }
    readInt8() {
        const result = this.data.readInt8(this.offset);
        this.offset += 1;
        return result;
    }
    readUInt8() {
        const result = this.data.readUInt8(this.offset);
        this.offset += 1;
        return result;
    }
    readFloatLE() {
        const result = this.data.readFloatLE(this.offset);
        this.offset += 4;
        return result;
    }
    seek(pos) {
        this.offset = pos;
    }
    skip(length) {
        this.offset += length;
    }
    tell() {
        return this.offset;
    }
}

class FGuid {
    constructor(reader) {
        this.A = reader.readUInt32LE();
        this.B = reader.readUInt32LE();
        this.C = reader.readUInt32LE();
        this.D = reader.readUInt32LE();
    }

    toString() {
        return [this.A, this.B, this.C, this.D].map(v => v.toString(16).padStart(8, '0')).join('');
    }
}

main failed => aiosasl.AuthenticationFailure: user intervention: authentication failed: authentication aborted by user

Once every 1-2 days this error appears, I can’t handle it, pls help

main failed
Traceback (most recent call last):
  File "/root/.local/share/virtualenvs/fsl-new-bots-vcMLNSov/lib/python3.6/site-packages/aioxmpp/node.py", line 843, in _on_main_done
    task.result()
  File "/root/.local/share/virtualenvs/fsl-new-bots-vcMLNSov/lib/python3.6/site-packages/aioxmpp/node.py", line 1010, in _main
    yield from self._main_impl()
  File "/root/.local/share/virtualenvs/fsl-new-bots-vcMLNSov/lib/python3.6/site-packages/aioxmpp/node.py", line 970, in _main_impl
    logger=self.logger)
  File "/root/.local/share/virtualenvs/fsl-new-bots-vcMLNSov/lib/python3.6/site-packages/aioxmpp/node.py", line 385, in connect_xmlstream
    jid, metadata, negotiation_timeout, loop, logger,
  File "/root/.local/share/virtualenvs/fsl-new-bots-vcMLNSov/lib/python3.6/site-packages/aioxmpp/node.py", line 278, in _try_options
    features=features,
  File "/root/.local/share/virtualenvs/fsl-new-bots-vcMLNSov/lib/python3.6/site-packages/aioxmpp/security_layer.py", line 1200, in negotiate_sasl
    raise last_auth_error
  File "/root/.local/share/virtualenvs/fsl-new-bots-vcMLNSov/lib/python3.6/site-packages/aioxmpp/security_layer.py", line 1184, in negotiate_sasl
    jid, features, xmlstream, transport)
  File "/root/.local/share/virtualenvs/fsl-new-bots-vcMLNSov/lib/python3.6/site-packages/aioxmpp/security_layer.py", line 982, in execute
    intf, mechanism, token)
  File "/root/.local/share/virtualenvs/fsl-new-bots-vcMLNSov/lib/python3.6/site-packages/aioxmpp/security_layer.py", line 847, in _execute
    yield from mechanism.authenticate(sm, token)
  File "/root/.local/share/virtualenvs/fsl-new-bots-vcMLNSov/lib/python3.6/site-packages/aiosasl/__init__.py", line 605, in authenticate
    username, password = yield from self._credential_provider()
  File "/root/.local/share/virtualenvs/fsl-new-bots-vcMLNSov/lib/python3.6/site-packages/aioxmpp/security_layer.py", line 959, in credential_provider
    text="authentication aborted by user")
aiosasl.AuthenticationFailure: user intervention: authentication failed: authentication aborted by user

Add Support for Support a Creator Checks

Endpoint to check if a Code is valid:
GET https://affiliate-public-service-prod.ol.epicgames.com/affiliate/api/public/affiliates/slug/%creator_code%

Search for a Creator Code:
GET unknown

For more information about the Endpoints/the usage you can maybe ask amrsatrio#8564. He has advanced knowledge.

fortnitepy.Client.close() spams the same asyncio exception 7 times

Exception ignored in: <function _ProactorBasePipeTransport.__del__ at 0x00000272DC5CB700>
Traceback (most recent call last):
  File "C:\Program Files\Python38\lib\asyncio\proactor_events.py", line 116, in __del__
    self.close()
  File "C:\Program Files\Python38\lib\asyncio\proactor_events.py", line 108, in close
    self._loop.call_soon(self._call_connection_lost, None)
  File "C:\Program Files\Python38\lib\asyncio\base_events.py", line 719, in call_soon
    self._check_closed()
  File "C:\Program Files\Python38\lib\asyncio\base_events.py", line 508, in _check_closed
    raise RuntimeError('Event loop is closed')
RuntimeError: Event loop is closed

Error when fetching a member profile

I tried to fetch a user profile:
user = await self.fetch_profile_by_display_name('Luc1412')
and got this error:

File "C:\Users\luc14\AppData\Local\Programs\Python\Python38-32\lib\site-packages\fortnitepy\client.py", line 1043, in fetch_profile_by_display_name
    account = max(epic_accounts, key=lambda d: d['externalAuths'])
TypeError: '>' not supported between instances of 'dict' and 'dict'

fortnitepy conflicts with latest version sanic

Pipenv has conflict versions of multidict

There are incompatible versions in the resolved dependencies:
  multidict<5,>=2.0 (from aioxmpp==0.11.0->fortnitepy==3.3.2->-r /tmp/pipenvwru3hi2_requirements/pipenv-73vfg3hz-constraints.txt (line 7))
  multidict<7.0,>=4.5 (from aiohttp==3.7.2->fortnitepy==3.3.2->-r /tmp/pipenvwru3hi2_requirements/pipenv-73vfg3hz-constraints.txt (line 7))
  multidict==5.0.0 (from sanic==20.9.1->-r /tmp/pipenvwru3hi2_requirements/pipenv-73vfg3hz-constraints.txt (line 8))

Improve Server Status Information

Maintenance Coutdown:
Add the Countdown for Maintenace which can be found in the lightswitch endpoint.

countdown_to_maintenance_in_ms = response['timeToShutdownInMs']

If there is no maintenance 'timeToShutdownInMs' is not in the response included.

Details for Services:
I don't know if this fit's in the API, cuz it's not directly an Endpoint from Epic, but it's possible to get the separated Service Status with 2 Methods:

Parsing the HTML File (I currently use that method):

with urllib.request.urlopen('https://status.epicgames.com/') as fp:
    html = BeautifulSoup(fp, 'html.parser')
    components_cont = html.find('div', attrs={'class': 'child-components-container'})
    components = components_cont.findAll('div', recursive=False)
    for component in components:
        name = component.find('span', attrs={'class': 'name'}).getText(strip=True).replace(' ', '').lower()
        status = component.find('span', attrs={'class': 'component-status'}).getText(strip=True).replace(' ', '').lower()
        data[name] = status

(Could be changed to async)

Get it from the json:
Endpoint: https://status.epicgames.com/index.json

I'm not sure how to get the separated information. It could be only displayed if a Service is down.

Login problem

can you create a tutorial for the login section? I don't know what is auth_device.json file is? and how can I get device_id and secret?
I try to create a bot for tracking Fortnite player's stats but I cant to login with email and password.
and I can't find it in the documentation .
Thank you for your help !!

Update default outfits to reflect Chapter 2 changes.

Since the start of Chapter 2, the default skins have changed from:

class DefaultCharacters(Enum):
    CID_001_Athena_Commando_F_Default = 1
    CID_002_Athena_Commando_F_Default = 2
    CID_003_Athena_Commando_F_Default = 3
    CID_004_Athena_Commando_F_Default = 4
    CID_005_Athena_Commando_M_Default = 5
    CID_006_Athena_Commando_M_Default = 6
    CID_007_Athena_Commando_M_Default = 7
    CID_008_Athena_Commando_M_Default = 8

to

class DefaultCharacters(Enum):
    CID_556_Athena_Commando_F_RebirthDefaultA = 1
    CID_557_Athena_Commando_F_RebirthDefaultB = 2
    CID_558_Athena_Commando_F_RebirthDefaultC = 3
    CID_559_Athena_Commando_F_RebirthDefaultD = 4
    CID_560_Athena_Commando_M_RebirthDefaultA = 5
    CID_561_Athena_Commando_M_RebirthDefaultB = 6
    CID_562_Athena_Commando_M_RebirthDefaultC = 7
    CID_563_Athena_Commando_M_RebirthDefaultD = 8

Sorry your login does not posses the permissions 'account:public:account:deviceAuths CREATE' needed to perform the requested operation

Trying to call account_generate_device_auth but allways get the following error back:
{
"errorCode": "errors.com.epicgames.common.missing_permission",
"errorMessage": "Sorry your login does not posses the permissions 'account:public:account:deviceAuths CREATE' needed to perform the requested operation",
"messageVars": [
"account:public:account:deviceAuths",
"CREATE"
],
"numericErrorCode": 1023,
"originatingService": "com.epicgames.account.public",
"intent": "prod"
}

Any idea why?

AttributeError

AttributeError: 'PartyInvitation' object has no attribute 'author'
When you try doing something like on_party_invite: print(f"Accepted party invite from {invite.author.display_name}") it outputs this error.

How to handel errors?

After few days i get error "aiosasl.AuthenticationFailure: user intervention: authentication failed: authentication aborted by user", but how handle it, program not stopped

set_ready is not working.

I've written this code

@bot.command(name="sitout")
async def sitoutCommand(ctx):
    await bot.party.me.set_ready(fortnitepy.ReadyState.SITTING_OUT)
    await ctx.send("aaa")

The chat will output aaa, but it is not in sitout state.

I need help

I want that the bot have a skin when i start the bot and join the bot when i make this command in my python file: " async def event_party_member_join(self, member):
clientmember = client.user.party.me
await clientmember.set_outfit(asset="CID_467_Athena_Commando_M_WeirdObjectsPolice")" then the file is not starting.

Add ProfileBanner variant channel.

Editing the variant dictionary from:

config = {
            'pattern': 'Mat{}',
            'numeric': 'Numeric.{}',
            'clothing_color': 'Mat{}',
            'jersey_color': 'Color.{}',
            'parts': 'Stage{}',
            'progressive': 'Stage{}',
            'particle': '{}{}',
            'material': 'Mat{}',
            'emissive': 'Emissive{}'
        }

To include 'ProfileBanner': {} will allow you to use your current equipped banner on banner cosmetics instead of the default red blank one.

Move user?

Is it possible to move the fortnite user in the game with this library?

Add Support for Fortnite Gamemode List (with active ones)

Get all Gamemodes:
Endpoint: https://fortnitecontent-website-prod07.ol.epicgames.com/content/api/pages/fortnite-game
Where is the data stored: result['playlistinformation']['playlist_info']['playlists']
What is important? image, name, violator, description (Name is internal)

How to get the Real Playlist Names:
Trough the Game files, but I dunno the Location

How to get actives:
Endpoints: https://fortnite-public-service-prod11.ol.epicgames.com/fortnite/api/calendar/v1/timeline
Where is the data stored: result['channels']['client-matchmaking']['states'][INDEX]
Check date/time: data['validFrom']
Get the Infos: data['state']['region'][REGION]['eventFlagsForcedOn'][INDEX]

PartyError: Incompatible net_cl

When i inviting the "bot" then is coming a error example: "Task exception was never retrieved
future: <Task finished coro=<XMPPClient.process_event_message() done, defined at C:\Users*\Desktop\fortnitepy-master\fortnitepy\xmpp.py:88> exception=PartyError('Incompatible net_cl')>
Traceback (most recent call last):
File "C:\Users*
\Desktop\fortnitepy-master\fortnitepy\xmpp.py", line 185, in process_event_message
raise PartyError('Incompatible net_cl')
fortnitepy.errors.PartyError: Incompatible net_cl"

Getting conflict after the login

I'm getting a Conflict 409 status code response from the epiclogin method.
It was working all fine for the last few month but this error started from 2 days ago.
Anyone else had it? is there a solution for it? my account email/password did not change

i cannot get the shop?

Task exception was never retrieved
future: <Task finished name='Task-139' coro=<event_ready() done, defined at main.py:21> exception=IndexError('list index out of range')>
Traceback (most recent call last):
  File "main.py", line 23, in event_ready
    shop = await get_current_item_shop_cids()
  File "main.py", line 11, in get_current_item_shop_cids
    store = await client.fetch_item_shop()
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/fortnitepy/client.py", line 3291, in fetch_item_shop
    return Store(self, data)
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/fortnitepy/store.py", line 232, in __init__
    self._featured_items = self._create_featured_items(
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/fortnitepy/store.py", line 318, in _create_featured_items
    res.append(FeaturedStoreItem(item))
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/fortnitepy/store.py", line 193, in __init__
    super().__init__(data)
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/fortnitepy/store.py", line 53, in __init__
    self._price = data['prices'][0]['finalPrice']
IndexError: list index out of range

i get this error when running the code

import fortnitepy

client = fortnitepy.Client(
  auth=fortnitepy.AuthorizationCodeAuth(
    code=input('codeL: ')
  )
)


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

@client.event
async def event_ready():
  shop = await get_current_item_shop_cids()
  print(shop)

client.run()
``` please fix it.

Error when importing module

Traceback (most recent call last):
  File "C:\Users\Stefano\Desktop\UBOT\fn.py", line 1, in <module>
    import fortnitepy
  File "C:\Users\Stefano\AppData\Local\Programs\Python\Python39\lib\site-packages\fortnitepy\__init__.py", line 30, in <module>
    from .client import Client, run_multiple, start_multiple, close_multiple
  File "C:\Users\Stefano\AppData\Local\Programs\Python\Python39\lib\site-packages\fortnitepy\client.py", line 34, in <module>
    from aioxmpp import JID
  File "C:\Users\Stefano\AppData\Local\Programs\Python\Python39\lib\site-packages\aioxmpp\__init__.py", line 101, in <module>
    from .errors import (  # NOQA
  File "C:\Users\Stefano\AppData\Local\Programs\Python\Python39\lib\site-packages\aioxmpp\errors.py", line 90, in <module>
    from . import xso, i18n, structs
  File "C:\Users\Stefano\AppData\Local\Programs\Python\Python39\lib\site-packages\aioxmpp\xso\__init__.py", line 588, in <module>
    from .types import (  # NOQA: F401
  File "C:\Users\Stefano\AppData\Local\Programs\Python\Python39\lib\site-packages\aioxmpp\xso\types.py", line 46, in <module>
    from .. import structs, i18n
  File "C:\Users\Stefano\AppData\Local\Programs\Python\Python39\lib\site-packages\aioxmpp\i18n.py", line 48, in <module>
    import babel.dates
  File "C:\Users\Stefano\AppData\Local\Programs\Python\Python39\lib\site-packages\babel\dates.py", line 29, in <module>
    from babel.util import UTC, LOCALTZ
  File "C:\Users\Stefano\AppData\Local\Programs\Python\Python39\lib\site-packages\babel\util.py", line 20, in <module>
    from babel import localtime
  File "C:\Users\Stefano\AppData\Local\Programs\Python\Python39\lib\site-packages\babel\localtime\__init__.py", line 74, in <module>
    LOCALTZ = get_localzone()
  File "C:\Users\Stefano\AppData\Local\Programs\Python\Python39\lib\site-packages\babel\localtime\__init__.py", line 70, in get_localzone
    return _get_localzone()
  File "C:\Users\Stefano\AppData\Local\Programs\Python\Python39\lib\site-packages\babel\localtime\_win32.py", line 96, in _get_localzone
    return pytz.timezone(get_localzone_name())
  File "C:\Users\Stefano\AppData\Local\Programs\Python\Python39\lib\site-packages\babel\localtime\_win32.py", line 42, in get_localzone_name
    localtz = winreg.OpenKey(handle, TZLOCALKEYNAME)
FileNotFoundError: [WinError 2] Impossibile trovare il file specificato

Can't set variants with arguments.

Here is my current code:

@client.event
async def event_friend_message(message):
    args = message.content.split()
    print('Received message from {0.author.display_name} | Content: "{0.content}"'.format(message))

        if "!variants" in args[0]:
        variants = client.user.party.me.create_variants(*{args[2]: args[3]})

        await client.user.party.me.set_outfit(
            asset=args[1],
            variants=variants
        )

        await message.reply('Skin set to' + args[1])

It sets the skin, but the variant doesn't change. I've been told by multiple people (that aren't familiar with fortnitepy) that the code should work although it doesn't so I thought I'd ask you as a last resort. Sorry for bothering! :/

Update benbot & fortnite-api.com examples

Benbot

The benbot examples url and endpoints are depcreated/not available anymore.

Fortnite-API

These examples still using the deprecated V1 version of the API. Updating the code for V2 is necessary.

Offer a way to just login without using XMPP

Reason:

Save memory and bandwidth when using fortnitepy to just fetch some data.

Implementation:

Similar to Discord.py a connect() and login() method can be useful. Connect connects to XMPP, Login just handles authorization.

.start() and .run() will execute both.

AttributeError: 'NoneType' object has no attribute 'get_raw'

Task exception was never retrieved
future: <Task finished coro=<XMPPClient.process_event_message() done, defined at /fsl-bot/fpy/xmpp.py:92> exception=AttributeError("'NoneType' object has no attribute 'get_raw'",)>
Traceback (most recent call last):
  File "/fsl-bot/fpy/xmpp.py", line 155, in process_event_message
    self.client.store_user(f.get_raw())
AttributeError: 'NoneType' object has no attribute 'get_raw'

Prevent duplicate account ids in run_multiple

I'm sure not a priority at all, but I accidentally was generating device auths for one account for what I thought was multiple accounts. Fornitepy didn't complain at all and just ran them, which caused... interesting issues, which were not super helpful in the debugging the issue (mostly "unknown party id" bugs).

I absolutely would not expect Fortnitepy to have known any better, but a simple check on fortnitepy.run_multiple() to ensure that no accounts have the same account_id could be potentially helpful in preventing this issue for any future devs.

Migrate library to asyncio.run & bump Python Version requirement to 3.7

As Python 3.10 removes the loop parameter it's time to adapt to modern asyncio standards including the usage of asyncio.run.

This requires at least Python 3.7. As Python 3.5 and 3.6 no longer receive security updates, it's time to drop support. Since the lifetime of Python 3.7 is also coming to an end soon, you could directly update to Python 3.8 as well.

Add a way to get on the last updat date for battle pass level methods.

The fetch_battlepass_level and fetch_multiple_battlepass_level should include way to get on the last update date or check the date internal, because you need to check whether the last update was in the latest Season or not. Otherwise the BP lvl from the Season before is shown.
So either the method will check it itself and set the BP in this case to 0 or the method provide this date.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.