What do you want to save?
Add Code snippet
New code examples
-
Other 2022-02-28 19:05:02
handle s3 exceptions boto3
import boto3 from botocore.exceptions import ClientError try: iam = boto3.client('iam') user = iam.create_user(UserName='fred') print("Created user: %s" % user) except ClientError as e: if e.response['Error']['Code'] == 'EntityA... Add solution -
Python 2022-01-22 13:40:54
json textract response
# Call Amazon Textract and get JSON response # client = boto3.client('textract') # response = client.analyze_document(Document={...}, FeatureTypes=[...]) # Parse JSON response from Textract doc = Document(response) # Iterate over elements in the docum... Add solution -
Python 2021-10-14 03:49:08
boto3 create bucket
import logging import boto3 from botocore.exceptions import ClientError def create_bucket(bucket_name, region=None): """Create an S3 bucket in a specified region If a region is not specified, the bucket is created in the S3 defau... Add solution -
Python 2021-10-05 06:29:04
how to read the csv file using pandas in aws lambda
import json import os import boto3 import csv import sys import pandas as pd from io import BytesIO s3_client = boto3.client('s3') bucket_name ='bucket_name' s3_file_name ='s3_file_name.csv' def lambda_handler(event, context): print(event) try:... Add solution -
Python 2021-10-04 21:39:03
how to download excel file from s3 using python
import boto3 BUCKET_NAME = 'Enter Your Bucket Name' BUCKET_FILE_NAME = 'Enter File To be download' LOCAL_FILE_NAME = 'Local File Name' def download_s3_file(): s3 = boto3.client('s3') s3.download_file(BUCKET_NAME, BUCKET_FILE_NAME, LOCAL_FILE_NAME) Add solution -
TypeScript 2021-09-23 04:11:03
s3.bucket objects filter top 10
import boto3 client = boto3.client('s3') paginator = client.get_paginator('list_objects') for result in paginator.paginate(Bucket='edsu-test-bucket', Delimiter='/'): for prefix in result.get('CommonPrefixes'): print(prefix.get('Prefix')) Add solution