Skip to content

Instantly share code, notes, and snippets.

View water_order.py
from slackclient import SlackClient
import json
import logging
from dateutil.relativedelta import relativedelta
import urllib.parse
import ast
import boto3
import datetime
ch_id='XXXXXXXXXX' #本番用
View button.py
class Button:
def __init__(self,S3_MONTH_LOG_NAME,NOWTIME,TODAY):
self.nowtime=NOWTIME
self.today=TODAY
self.s3=S3(S3_MONTH_LOG_NAME,NOWTIME)
def count(self,w_count,c_count):
data=self.s3.load_db()
data['water'] += w_count
data['paper_cups'] += c_count
View water_order.py
def lambda_handler(event, context):
#---logging_set--------------------------------------
logger = logging.getLogger()
logger.setLevel(logging.INFO)
logging.info(json.dumps(event)) #cloud_watchへのロギング必要無ければ本番環境で削除
#---time---use-S3------------------------------------------------
JST = datetime.timezone(datetime.timedelta(hours=+9), 'JST')
now = datetime.datetime.now(JST)
NOWTIME = now.strftime("%Y/%m/%d-%H:%M")
You can’t perform that action at this time.