def exile_query2(): #apiKey = "DEVELOPMENT-Indexer" url = "http://api.exiletools.com/index/_search?search_type=count&pretty" query ='{\ "aggs":{\ "leagues":{\ "terms": {"field": "attributes.league", "min_doc_count":5000,"size": 0}\ }\ }\ }' request = ExileRequest(url,None, query) result = request.execute() print("Running exile_query2") print(dashes) #print the entire result print("Print the entire query result:") pprint.pprint(result) print(dashes) writeToFile(os.curdir, "test.json", json.dumps(result, indent=4)) return 0
def exile_query(): apiKey = "DEVELOPMENT-Indexer" request = ExileRequest("http://api.exiletools.com/index/_mapping/field/shop.*?pretty", apiKey, None) result = request.execute() #dashes = "-----------------------------------------------------------------" #print the entire result print("Running exile_query") print(dashes) print("Print the entire query result:") pprint.pprint(result) print(dashes) #Create a shortcut dictionary tmp_dic = result['poe']['mappings']['item'] #print just the entries for the shop.added key print("Print just the shop.added nodes.") pprint.pprint(tmp_dic['shop.added']) print(dashes) #get the shop.added key value and assing to a variable shopAddedName = tmp_dic['shop.added']['full_name'] #print a message with the variable print('This is the shop.added name: %s' % shopAddedName) print(dashes) return 0