From 207bab717584f69c447633642f3ece5b1864d4bc Mon Sep 17 00:00:00 2001 From: Anna Wiggins Date: Thu, 21 Jan 2016 14:36:00 -0500 Subject: [PATCH 1/4] Add edmc submodule. --- .gitmodules | 3 +++ edmc | 1 + 2 files changed, 4 insertions(+) create mode 100644 .gitmodules create mode 160000 edmc diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..0147278 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "edmc"] + path = edmc + url = https://github.com/annabunches/EDMarketConnector.git diff --git a/edmc b/edmc new file mode 160000 index 0000000..eeb0770 --- /dev/null +++ b/edmc @@ -0,0 +1 @@ +Subproject commit eeb0770bbeedc57a786f4575ab44d0c4bf5ba60a From 0654796a1a5d6809041695591971e3f857a9989c Mon Sep 17 00:00:00 2001 From: Anna Wiggins Date: Thu, 21 Jan 2016 14:42:44 -0500 Subject: [PATCH 2/4] Add companion API. --- companion.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 companion.py diff --git a/companion.py b/companion.py new file mode 100644 index 0000000..961d46e --- /dev/null +++ b/companion.py @@ -0,0 +1,20 @@ +from edmc import companion as c +import platform +import easygui + +companion_session = companion.Session() + +def login(username, password): + try: + companion_session.login(username, password) + except companion.VerificationRequired: + 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() From 588997e3127dca13c8899f2ec08c2ff2f19070bc Mon Sep 17 00:00:00 2001 From: Anna Wiggins Date: Thu, 21 Jan 2016 14:44:23 -0500 Subject: [PATCH 3/4] Fix migration errors. --- companion.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/companion.py b/companion.py index 961d46e..12e8044 100644 --- a/companion.py +++ b/companion.py @@ -2,12 +2,12 @@ from edmc import companion as c import platform import easygui -companion_session = companion.Session() +companion_session = c.Session() def login(username, password): try: companion_session.login(username, password) - except companion.VerificationRequired: + except c.VerificationRequired: if platform.system() == 'Windows': code = easygui.enterbox("Input Verification Code (check your email)", "Verification Required") From 7078b7dc3801765d519586ba0b145f88b1e1447b Mon Sep 17 00:00:00 2001 From: Anna Wiggins Date: Thu, 21 Jan 2016 15:13:33 -0500 Subject: [PATCH 4/4] Add some code for Windows to help SSL work. --- companion.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/companion.py b/companion.py index 12e8044..3e14500 100644 --- a/companion.py +++ b/companion.py @@ -1,6 +1,10 @@ -from edmc import companion as c -import platform import easygui +from edmc import companion as c +import os +import platform + +if platform.system() == 'Windows': + os.environ['REQUESTS_CA_BUNDLE'] = "requests/cacert.pem" companion_session = c.Session()