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
|
#!/usr/bin/python
|
||||||
|
|
||||||
from edmc.companion import Session, VerificationRequired
|
from elite_api import companion
|
||||||
import argparse
|
import argparse
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
import os
|
import os
|
||||||
|
@ -14,13 +14,8 @@ def main():
|
||||||
session = Session()
|
session = Session()
|
||||||
flags = flag_parser.parse_args()
|
flags = flag_parser.parse_args()
|
||||||
|
|
||||||
try:
|
companion.login(settings.get('ed_companion', 'username'), settings.get('ed_companion', 'password'))
|
||||||
session.login(settings.get('ed_companion', 'username'), settings.get('ed_companion', 'password'))
|
data = companion.get_data()
|
||||||
except VerificationRequired:
|
|
||||||
code = raw_input("Input Verification Code: ")
|
|
||||||
session.verify(code)
|
|
||||||
|
|
||||||
data = session.query()
|
|
||||||
|
|
||||||
# Now we have the data!
|
# Now we have the data!
|
||||||
if flags.dump:
|
if flags.dump:
|
||||||
|
|
|
@ -1,25 +1,14 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
|
|
||||||
from edmc import companion
|
from elite_api import companion
|
||||||
from inara.inara import InaraSession
|
from elite_api.inara import InaraSession
|
||||||
import utils
|
import utils
|
||||||
|
|
||||||
settings = utils.get_settings()
|
settings = utils.get_settings()
|
||||||
companion_session = companion.Session()
|
|
||||||
inara_session = InaraSession(settings.get('inara', 'username'), settings.get('inara', 'password'))
|
inara_session = InaraSession(settings.get('inara', 'username'), settings.get('inara', 'password'))
|
||||||
|
|
||||||
try:
|
companion.login(settings.get('ed_companion', 'username'), settings.get('ed_companion', 'password'))
|
||||||
companion_session.login(settings.get('ed_companion', 'username'), settings.get('ed_companion', 'password'))
|
data = companion.get_data()
|
||||||
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()
|
|
||||||
|
|
||||||
inara_session.update_credits(data['commander']['credits'])
|
inara_session.update_credits(data['commander']['credits'])
|
||||||
inara_session.update_location(data['lastSystem']['name'])
|
inara_session.update_location(data['lastSystem']['name'])
|
||||||
|
|
Reference in New Issue
Block a user