Package: fflogsapi
fflogsapifflogsapi is a lazy Python 3 client forFF Logs' v2 API with query caching functionality.FeaturesRetrieve information from FF Logs' v2 GraphQL APIIncluding private information only accessible through the user APILazy evaluationQueries for data are not executed until the result is explicitly neededQuery cachingRequesting the same data twice will instead fetch the result from cacheCustomizable cache lifetime and options to ignore cached resultsInstallationfflogsapi is available as aPyPI packageand
can be installed with pip:pipinstallfflogsapiIf you want to contribute, you can install fflogsapi with the following to
additionally install development and test tools:pipinstallfflogsapi[dev,test]Example usageCalculating damage done under pots:fromconfigimportCLIENT_ID,CLIENT_SECRETfromfflogsapiimportFFLogsClientclient=FFLogsClient(CLIENT_ID,CLIENT_SECRET)report=client.get_report('rGARYmQwTKbahXz9')forfightinreport:print(f'Fight #{fight.fight_id}:',fight.name(),f'- Kill:{fight.is_kill()}')pot_table=fight.table(filters={'sourceAurasPresent':'Medicated'})potted_damage=0fordamageinpot_table['damageDone']:potted_damage+=damage['total']print(f'Damage done under pots:{potted_damage}')ifnotfight.is_kill():print(f'Percentage reached:{fight.percentage()}')client.close()client.save_cache()Listing reports and durations for a specific guild:fromconfigimportCLIENT_ID,CLIENT_SECRETfromfflogsapiimportFFLogsClientclient=FFLogsClient(CLIENT_ID,CLIENT_SECRET)forpageinclient.reports(filters={'guildID':80551}):print(f'Reports in page:{page.count()}')forreportinpage:print(report.title(),f'Duration:{report.duration()}')client.close()client.save_cache()Listing a character's RDPS & All stars rank for Abyssos Savage in 6.28:fromconfigimportCLIENT_ID,CLIENT_SECRETfromfflogsapiimportFFLogsClient,GQLEnum,FightDifficultyclient=FFLogsClient(CLIENT_ID,CLIENT_SECRET)character=fapi.get_character(id=19181640)abyssos=fapi.get_zone(id=49)partition_628=next(filter(lambdap:'6.28'inp.name,abyssos.partitions()))rankings=character.zone_rankings(filters={'specName':'Reaper','metric':GQLEnum('rdps'),'zoneID':abyssos.id,'difficulty':FightDifficulty.SAVAGE.value,'partition':partition_628.id,})print('6.28 All Star points: 'f'{rankings.all_stars[0].points}(rank{rankings.all_stars[0].rank})')forrankinrankings.encounter_ranks:print(f'{rank.encounter.name()}:{rank.best_amount}rdps (rank{rank.all_stars.rank})')client.close()client.save_cache()User modeThe default mode of the client is 'client' mode, which uses the public API. This is by far the most
convenient method to use the client, and usually provides enough functionality for the majority of
use cases.If you need access to private information, however, it is possible to use the client in user mode,
granting access to extra information such as private reports provided by the user API.To use user mode, you must first specifyhttps://localhost:4433as the redirect URL in your API
client on FF Logs. Then, provide themode='user'kwarg to the client when instantiating it:client=FFLogsClient(CLIENT_ID,CLIENT_SECRET,mode='user')This will have the client popup a browser window for the user for login, after which the client has
access to the user API. Note that the client will generate a self-signed certificate to serve
the redirect. Your browser will likely produce a warning about this, although it is safe to ignore.If you wish to handle the user authentication flow yourself, you can still use the API client in
user mode by callingset_auth_responseon the clientbefore using it:# Your implementation of the user authentication flow here...client=FFLogsClient(CLIENT_ID,CLIENT_SECRET,mode='user')client.set_auth_response(response)# Start using the client...