Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #This python script gets you attrinutes for any object
- import requests
- import json
- #Call ESI
- Input = input("Give type ID: ")
- Url = "https://esi.tech.ccp.is/latest/universe/types/"+Input+"/?datasource=tranquility&language=en-us"
- #Uncomment this to get SISI stats
- #Url = "https://esi.tech.ccp.is/latest/universe/types/"+Input+"/?datasource=singularity&language=en-us"
- EsiResponse = requests.get(Url)
- NPCStats = EsiResponse.json()
- #Find out what each of the dogma IDs mean
- try:
- #Load cached dogma attribute ID info
- attributes = json.load(open('attributes.txt'))
- except FileNotFoundError:
- #No file found. Start from scratch
- attributes = {}
- length = len(NPCStats['dogma_attributes'])
- for n in range(0, length):
- DogmaID = NPCStats['dogma_attributes'][n]['attribute_id']
- if not str(DogmaID) in attributes:
- #Find what this ID is for
- print('Getting info on dogma attribute ID', DogmaID)
- Url = "https://esi.tech.ccp.is/latest/dogma/attributes/"+str(DogmaID)+"/?datasource=tranquility"
- attributes[str(DogmaID)] = requests.get(Url).json()['display_name']
- #Save the ID list
- with open('attributes.txt', 'w') as outfile:
- json.dump(attributes, outfile)
- #Print the output
- print('\n----')
- print('Type ID:', NPCStats['type_id'])
- print('Name:', NPCStats['name'])
- print('----')
- print('Attributes:')
- for n in range(0, length):
- DogmaID = NPCStats['dogma_attributes'][n]['attribute_id']
- if attributes[str(DogmaID)]:
- #Print only for those that have display name for the attribute
- value = NPCStats['dogma_attributes'][n]['value']
- print( attributes[str(DogmaID)],value, sep = ': ')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement