Add companion API, and use it.
This commit is contained in:
parent
a6c4443ab7
commit
5303cc7766
|
@ -1 +1 @@
|
|||
Subproject commit 207bab717584f69c447633642f3ece5b1864d4bc
|
||||
Subproject commit 0654796a1a5d6809041695591971e3f857a9989c
|
|
@ -1,6 +1,6 @@
|
|||
#!/usr/bin/python
|
||||
|
||||
from edmc.companion import Session, VerificationRequired
|
||||
from elite_api import companion
|
||||
import argparse
|
||||
from pprint import pprint
|
||||
import os
|
||||
|
@ -14,13 +14,8 @@ def main():
|
|||
session = Session()
|
||||
flags = flag_parser.parse_args()
|
||||
|
||||
try:
|
||||
session.login(settings.get('ed_companion', 'username'), settings.get('ed_companion', 'password'))
|
||||
except VerificationRequired:
|
||||
code = raw_input("Input Verification Code: ")
|
||||
session.verify(code)
|
||||
|
||||
data = session.query()
|
||||
companion.login(settings.get('ed_companion', 'username'), settings.get('ed_companion', 'password'))
|
||||
data = companion.get_data()
|
||||
|
||||
# Now we have the data!
|
||||
if flags.dump:
|
||||
|
|
|
@ -1,25 +1,14 @@
|
|||
#!/usr/bin/python
|
||||
|
||||
from edmc import companion
|
||||
from inara.inara import InaraSession
|
||||
from elite_api import companion
|
||||
from elite_api.inara import InaraSession
|
||||
import utils
|
||||
|
||||
settings = utils.get_settings()
|
||||
companion_session = companion.Session()
|
||||
inara_session = InaraSession(settings.get('inara', 'username'), settings.get('inara', 'password'))
|
||||
|
||||
try:
|
||||
companion_session.login(settings.get('ed_companion', 'username'), settings.get('ed_companion', 'password'))
|
||||
except companion.VerificationRequired:
|
||||
if utils.windows_detected():
|
||||
code = easygui.enterbox("Input Verification Code (check your email)",
|
||||
"Verification Required")
|
||||
else:
|
||||
code = raw_input("Input Verification Code (check your email): ")
|
||||
companion_session.verify(code)
|
||||
|
||||
data = companion_session.query()
|
||||
companion_session.close()
|
||||
companion.login(settings.get('ed_companion', 'username'), settings.get('ed_companion', 'password'))
|
||||
data = companion.get_data()
|
||||
|
||||
inara_session.update_credits(data['commander']['credits'])
|
||||
inara_session.update_location(data['lastSystem']['name'])
|
||||
|
|
Reference in New Issue
Block a user