示例#1
0
 def get_data_thread(self):
     export_to_json = True if self.export_to_json.get() == 1 else False
     export_to_xlsx = True if self.export_to_xlsx.get() == 1 else False
     export_to_html = True if self.export_to_html.get() == 1 else False
     if export_to_json or export_to_xlsx or export_to_html:
         try:
             all_data = get_myeps_data(self.username.get(), self.password.get())
             save(all_data, self.username.get(), to_json=export_to_json, to_xlsx=export_to_xlsx,
                  to_html=export_to_html)
             self.status.set("Done")
         except LoginError:  # TODO return specific error messages with LoginError
             self.status.set("Wrong username/password")
     else:
         self.status.set("Choose at least one export format")
示例#2
0
__author__ = "fukszdomonkos"

import argparse
from myeps import get_myeps_data, save

parser = argparse.ArgumentParser()
parser.add_argument("-u", "--username", help="Specifies the username", type=str, required=True)
parser.add_argument("-p", "--password", help="Specifies the password", type=str, required=True)
parser.add_argument("-J", "--json", help="Export to JSON", action="store_true")
parser.add_argument("-X", "--xlsx", help="Export to Excel", action="store_true")
parser.add_argument("-H", "--html", help="Export to HTML", action="store_true")
args = parser.parse_args()
username = args.username
password = args.password
export_to_json = args.json
export_to_xlsx = args.xlsx
export_to_html = args.html

all_data = get_myeps_data(username, password)

save(all_data, username, to_json=export_to_json, to_xlsx=export_to_xlsx, to_html=export_to_html)