import requests
from secrets import *
+encounter_aliases = [
+ 'cloudRanks',
+ 'dogRanks',
+ 'thanRanks',
+ 'boobaRanks',
+ 'gaiaRanks',
+]
+
res = requests.post(
"https://www.fflogs.com/oauth/token",
data={"grant_type": "client_credentials"},
"serverRegion": "na",
}
result = client.execute(query, variable_values=params)
-print(result['characterData']['character']['cloudRanks']['ranks'][0]['report'])
-print(result['characterData']['character']['dogRanks']['ranks'][0]['report'])
-print(result['characterData']['character']['thanRanks']['ranks'][0]['report'])
-print(result['characterData']['character']['boobaRanks']['ranks'][0]['report'])
-print(result['characterData']['character']['gaiaRanks']['ranks'][0]['report'])
+encounter_ranks = [result['characterData']['character'][encounter_alias] for encounter_alias in encounter_aliases]
+ranks = [rank for encounter in encounter_ranks for rank in encounter['ranks']]
+pulls = [(rank['report']['code'], rank['report']['fightID']) for rank in ranks]
+query = gql(
+ '''
+ query ($code: String!, $fightIds: [Int]!) {
+ reportData {
+ report (
+ code: $code
+ )
+ {
+ code
+ fights (
+ fightIDs: $fightIds
+ )
+ {
+ hasEcho
+ kill
+ }
+ }
+ }
+ }
+ '''
+ )
+result = client.execute(query, variable_values={"code": pulls[0][0], "fightIds": pulls[0][1]})