コード例 #1
0
ファイル: tickets.py プロジェクト: kiawnna/zoho_api
def main(event, context):
    s3 = boto3.client('s3')
    path = 'tickets'
    try:
        now = datetime.now().strftime("%Y/%m/%d/%H:%M:%S")
        result = zoho_auth_function.main(path)
        response = result['body']['data']

        s3.put_object(Body=str(json.dumps(response)),
                      Bucket=BUCKET,
                      Key=f'{path}/{now}.json')
    except Exception as e:
        return str(e)
コード例 #2
0
def main(event, context):
    s3 = boto3.client('s3')
    department_id = event['department_id']
    params = f'?department={department_id}'
    base_path = 'customerHappiness'
    path = f'{base_path}{params}'
    try:
        now = datetime.now().strftime("%Y/%m/%d/%H:%M:%S")
        result = zoho_auth_function.main(path)
        response = result['body']['data']
        s3.put_object(
            Body=str(json.dumps(response)),
            Bucket=BUCKET,
            Key=f'{base_path}/departmentId:{department_id}/{now}.json')
    except Exception as e:
        return str(e)
コード例 #3
0
ファイル: queue-by_status.py プロジェクト: kiawnna/zoho_api
def main(event, context):
    s3 = boto3.client('s3')
    status = event['status']
    params = f'?status={status}'
    base_path = 'ticketsByStatus'
    path = f'{base_path}{params}'

    try:
        now = datetime.now().strftime("%Y/%m/%d/%H:%M:%S")
        result = zoho_auth_function.main(path)
        response = result['body']['data']

        s3.put_object(Body=str(json.dumps(response)),
                      Bucket=BUCKET,
                      Key=f'queue/{base_path}/{status}/{now}.json')
    except Exception as e:
        return str(e)