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.
elite_api/companion.py

25 lines
662 B
Python
Raw Normal View History

import easygui
2016-01-21 19:42:44 +00:00
from edmc import companion as c
import os
2016-01-21 19:42:44 +00:00
import platform
if platform.system() == 'Windows':
os.environ['REQUESTS_CA_BUNDLE'] = "requests/cacert.pem"
2016-01-21 19:42:44 +00:00
2016-01-21 19:44:23 +00:00
companion_session = c.Session()
2016-01-21 19:42:44 +00:00
def login(username, password):
try:
companion_session.login(username, password)
2016-01-21 19:44:23 +00:00
except c.VerificationRequired:
2016-01-21 19:42:44 +00:00
if platform.system() == 'Windows':
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)
def get_data():
return companion_session.query()