Hey thanks for quick response. Sorry for long response here.
I was not aware of those in the const.py. Those could be useful to me later.
You're right. I should be much more specific. Here is a snippet of code to illustrate what I'm after:
import os
import time
import cPickle as pickle
import eveapi
from reverence import blue
USER_ID = 0
API_KEY = ""
CHAR_NAME = ""
EVE_PATH = ""
class APICacher(object):
def __init__(self):
self.file_ext = ".api_result"
self.file_path = "./API_Cache/"
if not os.path.exists(self.file_path):
os.makedirs(self.file_path)
def retrieve(self, host, path, params):
hash_string = str(hash(str(host) + str(path) + str(params)))
file_name = self.file_path + hash_string + self.file_ext
cache_file= None
try:
cache_file= open(file_name, 'rb')
except IOError:
return None
else:
cache_object = pickle.load(cache_file)
cache_file.close()
if time.time() < cache_object.cachedUntil:
return cache_object
else:
return None
def store(self, host, path, params, doc, obj):
hash_string = str(hash(str(host) + str(path) + str(params)))
file_name = self.file_path + hash_string + self.file_ext
cache_file = open(file_name, 'wb')
pickle.dump(obj, cache_file)
cache_file.close()
eve = blue.EVE(EVE_PATH)
invtypes = eve.cfg.invtypes
api = eveapi.EVEAPIConnection(cacheHandler=APICacher())
auth = api.auth(userID=USER_ID, apiKey=API_KEY)
chars = auth.account.Characters().characters
char_id = None
for char in chars:
if char.name == CHAR_NAME:
char_id = char.characterID
corp_auth = auth.corporation(char_id)
for i in corp_auth.AssetList().assets:
print invtypes.get(i.typeID).typeName, "| flag= ", i.flag
if hasattr(i,"contents"):
for j in i.contents:
print " "*4, invtypes.get(j.typeID).typeName, "| flag= ", j.flag
if hasattr(j,"contents"):
for k in j.contents:
print " "*8, invtypes.get(k.typeID).typeName
The flag field gives me a number here that relates to this table:
link hereHow do I look up the flag number in this table and get either flagName or flagText?
It's worth noting that character I used is a CEO or director in his corp.
I'm going to apologize in advance if this is stupid or obvious but humor me anyway, if you would, please.
Thanks for any help!
Cheers,
-PL
*edit*
unfortunately, the forum destroys the indentations in the code. Oddly, if I go to Edit it...all the indentations are shown.