line_bot_api = LineBotApi(ACCESS_TOKEN) sent=False if("users" in me_config["LINE"]): users = me_config["LINE"]["users"] line_bot_api.multicast(users,TextSendMessage(text=msg)) sent=True if("group" in me_config["LINE"]): group = me_config["LINE"]["group"] line_bot_api.push_message(group,TextSendMessage(text=msg )) sent=True if not sent: line_bot_api.broadcast(TextSendMessage(text=msg)) me_config = mylib.get_config() os.makedirs(me_config["workdir"], exist_ok=True) # conn = sqlite3.connect(me_config["dbfile"]) # msg = makeReportMessage(conn) # print(msg) mfme = mfme_client.mfme_client(me_config["mfme"]) if len(sys.argv) >= 2: for i, arg in enumerate(sys.argv): print(i, ":", arg) if arg.startswith("https://moneyforward.com/users/two_step_verifications/verify"): mfme.MFAVerify(arg) if arg.startswith("#"):
# date, datetimeの変換関数 def json_serial(obj): # 日付型の場合には、文字列に変換します if isinstance(obj, (datetime.datetime, datetime.date)): return obj.isoformat() if isinstance(obj, Decimal): return str(obj) if isinstance(obj, object) and hasattr(obj, '__dict__'): return obj.__dict__ # return str(obj) # 上記以外はサポート対象外. raise TypeError("Type %s not serializable" % type(obj)) sbi_config = mylib.get_config("sbi.jsonc") sbi = sbi_client.sbi_client(sbi_config["sbi"]) sbi.login() # sbi.openStock('9984') script_dir = os.path.dirname(os.path.abspath(__file__)) sbi_hash = sbi.GetHashCode() growth = sbi.GetTopGrowth() # set additional stock info. con = mysql.create_connection() for stock in growth: SQL = f"SELECT trading_unit from stock_codes where code='{stock.stock_code}'" cur = con.cursor() cur.execute(SQL) rows = cur.fetchall()
self.clickByXPath( "//div[@class='close' and @type='button' and @data-dismiss='modal']" ) def requery_account(self, account_ids: List[str]): self.login() self.browser().get("https://moneyforward.com/accounts") for account_id in account_ids: self.clickByXPath( f"//*[@id='js-recorrect-form-{account_id}']/input") time.sleep(2) if __name__ == '__main__': mfme_config = mylib.get_config("coop.jsonc") client = mfme_client(mfme_config["mfme"]) client.login() # sbi.ActualBuyingIFDOCO(7513,quantity=0) # sbi.GetOrders() # sbi.openChart('5929') data = [] for i in range(3): data.append( PaymentRecord(mfme_config["mfme"]["account"], datetime.date(2021, 7, 27), f"てすと{i}", "123", "食費", "食費")) client.AddPaymentRecord(data) val = input('END OF __main__')
import sys import mylib import mfme_client config_file = "mfme_account_requery.json" if sys.argv[1:2]: config_file = sys.argv[1] me_config = mylib.get_config(config_file) mfme = mfme_client.mfme_client(me_config["mfme"]) mfme.requery_account(me_config["mfme"]["accounts"])