Update api.py, commander.py and one other file
This commit is contained in:
parent
9987481848
commit
c2a1f787a2
@ -244,7 +244,7 @@ class Api:
|
|||||||
else:
|
else:
|
||||||
raise e
|
raise e
|
||||||
ship.update(data)
|
ship.update(data)
|
||||||
return ship
|
return data
|
||||||
|
|
||||||
def survey(self, ship):
|
def survey(self, ship):
|
||||||
data = self.request('post', f'my/ships/{ship}/survey')
|
data = self.request('post', f'my/ships/{ship}/survey')
|
||||||
|
@ -262,3 +262,14 @@ class Commander(CommandLine):
|
|||||||
if not self.has_ship(): return
|
if not self.has_ship(): return
|
||||||
r = self.api.survey(self.ship)
|
r = self.api.survey(self.ship)
|
||||||
pprint(r)
|
pprint(r)
|
||||||
|
|
||||||
|
def do_extract(self, survey_str=''):
|
||||||
|
if not self.has_ship(): return
|
||||||
|
survey = None
|
||||||
|
if survey_str != '':
|
||||||
|
survey = self.resolve('Survey', survey_str)
|
||||||
|
result = self.api.extract(self.ship, survey)
|
||||||
|
|
||||||
|
symbol = mg(result,'extraction.yield.symbol')
|
||||||
|
units = mg(result,'extraction.yield.units')
|
||||||
|
print(units, symbol)
|
||||||
|
@ -25,10 +25,14 @@ class Survey(SystemMember):
|
|||||||
def is_expired(self):
|
def is_expired(self):
|
||||||
return time() > self.expires or self.exhausted
|
return time() > self.expires or self.exhausted
|
||||||
|
|
||||||
|
def waypoint(self):
|
||||||
|
p = self.symbol.split('-')
|
||||||
|
return '-'.join(p[:3])
|
||||||
|
|
||||||
def api_dict(self):
|
def api_dict(self):
|
||||||
return {
|
return {
|
||||||
'signature': self.symbol,
|
'signature': self.symbol,
|
||||||
'symbol': str(self.waypoint),
|
'symbol': self.waypoint(),
|
||||||
'deposits': [{'symbol': d} for d in self.deposits],
|
'deposits': [{'symbol': d} for d in self.deposits],
|
||||||
'expiration': self.expires_str,
|
'expiration': self.expires_str,
|
||||||
'size': size_names[self.size]
|
'size': size_names[self.size]
|
||||||
|
Loading…
Reference in New Issue
Block a user