This repository has been archived on 2019-12-04. You can view files and clone it, but cannot push or open issues or pull requests.
inara_updater/update_inara.py

25 lines
786 B
Python
Raw Normal View History

2015-10-26 00:51:48 +00:00
#!/usr/bin/python
from EDMarketConnector import companion
2015-10-26 00:51:48 +00:00
import inara
import utils
settings = utils.get_settings()
companion_session = companion.Session()
inara_session = inara.Session()
try:
companion_session.login(settings.get('ed_companion', 'username'), settings.get('ed_companion', 'password'))
except companion.VerificationRequired:
code = raw_input("Input Verification Code: ")
companion_session.verify(code)
inara_session.inara_login(settings.get('inara', 'username'), settings.get('inara', 'password'))
inara_session._inara_handled_request(inara_session.post, inara.URL_BASE)
data = companion_session.query()
inara_session.inara_update_credits(data['commander']['credits'])
inara_session.inara_update_location(data['lastSystem']['name'])
companion_session.close()