Listing contents of a bucket with boto3

boto3 files s3 bucket sub folders python 3 weeks, 4 days ago
import boto3 _BUCKET_NAME = 'Bucket_name' _PREFIX = 'Folder_name/' client = boto3.client('s3', aws_access_key_id="access_key",aws_secret_access_key="secret_key") def ListFiles(client): response = client.list_objects(Bucket=_BUCKET_NAME, Prefix=_PREFIX) for content in response.get('Contents', []): yield content.get('Key') file_list = ListFiles(client) for file in file_list: print (file)
34
Posted By
Deleting Amazon EBS snapshots older than n da
import sys
import boto3
import datetime
python aws boto3
Ramya Ramya
Lambda code for Creating VPC flow log autom
from __future__ import print_function
import json
import os
lambda boto3 aws python
Ramya Ramya
Removing IAM Users from IAM group
def remove_user():
    import boto3
    client = boto3.client('iam')
boto3 aws python
Ramya Ramya
Crating a bucket in S3 using boto3
import boto3
sess = Session(aws_access_key_id='aws_ke
            aws_secret_access_key='aws_s
boto3 s3 create bucket python
Reshma
Python Script to create AWS beanstalk
#!/usr/bin/python
  
import boto
python aws beanstalk
sandeep sandeep
List all files and folders using python os mo
import os

def list_files_folders(path):
python python-os
kishore_kumar
Get current environment variables in python
import os
env = os.environ

python python-os
kishore_kumar
Get os details using python os
import os
print os.uname()
# Don't use os.system('uname -a'), its j
python python-os
kishore_kumar
Get stats ( lines, words, char count ) of fil
def file_stats(path):
    f = open(path, 'r')
    lines = f.readlines()
python
kishore_kumar
Use map function in python
def get_double(num):
    return num * 2

python
kishore_kumar
Python sample codes for beginners
print "Welcome to python"
python
gaya38 gaya38
Python program for even number checking
a=input("Enter a value:")
if (a%2==0):
    print "The given number is even numb
python
gaya38 gaya38
Python program for prime number check
a=input("Enter a value:")
k=0
b=(a/2)+1
python
gaya38 gaya38
Pass command line arguments in python
import sys
x=len(sys.argv)
a=[]
python
gaya38 gaya38
Python program for the largest number in an a
a = [1,43,98,5]#Dummy data
for l in range(len(a)-1):
        if (a[l]>a[l+1]):
python
gaya38 gaya38
print list of even numbers within a range
n=100
a=[10,20,30,40,50]
b=[60,70,80,90]
python
gaya38 gaya38
generate fibonacci series in python
n=input("Enter the constraint to print n
m=input("Enter the maximum value to prin
a=0
python
gaya38 gaya38
Generate Random number within the range in py
import random
print random.uniform(10,500)
python
gaya38 gaya38
Shuffle list elements in python
import random;
z = [1,90,4,2]
z = random.shuffle(z)
python
gaya38 gaya38
use python requests to get contents of url (
import requests

req = requests.get("https://httpbin.org/
python python-requests
kishore_kumar