This repository has been archived on 2025-07-09. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
inara_updater/elite_info.py

27 lines
646 B
Python
Executable file

#!/usr/bin/python
from companion import Session, VerificationRequired
import os
import utils
def main():
settings = utils.get_settings()
session = Session()
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()
# Now we have the data!
print "Commander %s" % data['commander']['name']
print "Credits: %s" % data['commander']['credits']
print "Location: %s" % data['lastSystem']['name']
session.close()
if __name__ == "__main__":
main()