Skip to content

Commit 9bbc26f

Browse files
committed
Updated print messages
1 parent 5424a3e commit 9bbc26f

File tree

14 files changed

+64
-64
lines changed

14 files changed

+64
-64
lines changed

awss3copy-capi/s3copy.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
# s3copy.py
44
# It is an example that handles S3 buckets on AWS.
55
# It uses Client API (low-level) of Boto3.
6-
# Copy a object from a S3 bucket to another S3 bucket.
6+
# Copy an object from a S3 bucket to another S3 bucket.
77
# You must provide 3 parameters:
88
# SOURCE_BUCKET = Source bucket name
9-
# SOURCE_FILE = Source file name
9+
# SOURCE_OBJECT = Source file name
1010
# DESTINATION_BUCKET = Destination bucket name
1111

1212
import sys
@@ -19,17 +19,17 @@ def main():
1919
# which is the script itself.
2020
args = sys.argv[1:]
2121
if len(args) < 3:
22-
print('Not enough parameters. Proper Usage is: python s3copy.py <SOURCE_BUCKET> <SOURCE_FILE> <DESTINATION_BUCKET>')
22+
print('Not enough parameters.\nProper Usage is: python s3copy.py <SOURCE_BUCKET> <SOURCE_OBJECT> <DESTINATION_BUCKET>')
2323
sys.exit(1)
2424

2525
source_bucket_name = args[0]
2626
source_key = args[1]
2727
destination_bucket_name = args[2]
2828
destination_key = source_key
2929
print('From - bucket: ' + source_bucket_name)
30-
print('From - file: ' + source_key)
30+
print('From - object: ' + source_key)
3131
print('To - bucket: ' + destination_bucket_name)
32-
print('To - file: ' + destination_key)
32+
print('To - object: ' + destination_key)
3333

3434
# Create an S3 Client
3535
s3client = boto3.client('s3')
@@ -42,7 +42,7 @@ def main():
4242
'Key': source_key
4343
}
4444
s3client.copy(copy_source, destination_bucket_name, destination_key)
45-
print('\nCopied')
45+
print('Copied')
4646
except botocore.exceptions.ClientError as e:
4747
if e.response['Error']['Code'] == "404":
4848
print("Error: Not Found, problem with the parameters!!")

awss3copy-rapi/s3copy.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
# s3copy.py
44
# It is an example that handles S3 buckets on AWS.
55
# It uses Resource API (high-level) of Boto3.
6-
# Copy a object from a S3 bucket to another S3 bucket.
6+
# Copy an object from a S3 bucket to another S3 bucket.
77
# You must provide 3 parameters:
88
# SOURCE_BUCKET = Source bucket name
9-
# SOURCE_FILE = Source file name
9+
# SOURCE_OBJECT = Source file name
1010
# DESTINATION_BUCKET = Destination bucket name
1111

1212
import sys
@@ -19,17 +19,17 @@ def main():
1919
# which is the script itself.
2020
args = sys.argv[1:]
2121
if len(args) < 3:
22-
print('Not enough parameters. Proper Usage is: python s3copy.py <SOURCE_BUCKET> <SOURCE_FILE> <DESTINATION_BUCKET>')
22+
print('Not enough parameters.\nProper Usage is: python s3copy.py <SOURCE_BUCKET> <SOURCE_OBJECT> <DESTINATION_BUCKET>')
2323
sys.exit(1)
2424

2525
source_bucket_name = args[0]
2626
source_key = args[1]
2727
destination_bucket_name = args[2]
2828
destination_key = source_key
2929
print('From - bucket: ' + source_bucket_name)
30-
print('From - file: ' + source_key)
30+
print('From - object: ' + source_key)
3131
print('To - bucket: ' + destination_bucket_name)
32-
print('To - file: ' + destination_key)
32+
print('To - object: ' + destination_key)
3333

3434
# Instantiate the service resource object
3535
s3resource = boto3.resource('s3')
@@ -44,7 +44,7 @@ def main():
4444
'Key': source_key
4545
}
4646
dest_bucket.copy(copy_source, destination_key)
47-
print('\nCopied')
47+
print('Copied')
4848
except botocore.exceptions.ClientError as e:
4949
if e.response['Error']['Code'] == "404":
5050
print("Error: Not Found, problem with the parameters!!")

awss3create-capi/s3create.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ def main():
1919
# which is the script itself.
2020
args = sys.argv[1:]
2121
if len(args) < 1:
22-
print('Not enough parameters. Proper Usage is: python s3create.py <BUCKET_NAME>')
22+
print('Not enough parameters.\nProper Usage is: python s3create.py <BUCKET_NAME>')
2323
sys.exit(1)
2424

2525
bucket_name = args[0]
@@ -30,15 +30,15 @@ def main():
3030

3131
# Create the bucket object
3232
try:
33-
print('Creating bucket...')
33+
print('Creating bucket ...')
3434
response = s3client.create_bucket(ACL='private',
3535
Bucket=bucket_name,
3636
CreateBucketConfiguration={
3737
'LocationConstraint': region
3838
}
3939
)
4040
print(response)
41-
print('\nCreated')
41+
print('Created')
4242
print(response['Location'])
4343
except botocore.exceptions.ClientError as e:
4444
if e.response['Error']['Code'] == "BucketAlreadyOwnedByYou":

awss3create-rapi/s3create.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ def main():
1919
# which is the script itself.
2020
args = sys.argv[1:]
2121
if len(args) < 1:
22-
print('Not enough parameters. Proper Usage is: python s3create.py <BUCKET_NAME>')
22+
print('Not enough parameters.\nProper Usage is: python s3create.py <BUCKET_NAME>')
2323
sys.exit(1)
2424

2525
bucket_name = args[0]
@@ -33,14 +33,14 @@ def main():
3333

3434
# Create the bucket object
3535
try:
36-
print('Creating bucket...')
36+
print('Creating bucket ...')
3737
response = bucket.create(ACL='private',
3838
CreateBucketConfiguration={
3939
'LocationConstraint': region
4040
}
4141
)
4242
print(response)
43-
print('\nCreated')
43+
print('Created')
4444
print(response['Location'])
4545
except botocore.exceptions.ClientError as e:
4646
if e.response['Error']['Code'] == "BucketAlreadyOwnedByYou":

awss3delete-capi/s3delete.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ def main():
1717
# which is the script itself.
1818
args = sys.argv[1:]
1919
if len(args) < 1:
20-
print('Not enough parameters. Proper Usage is: python s3delete.py <BUCKET_NAME>')
20+
print('Not enough parameters.\nProper Usage is: python s3delete.py <BUCKET_NAME>')
2121
sys.exit(1)
2222

2323
bucket_name = args[0]
@@ -28,10 +28,10 @@ def main():
2828

2929
# Delete the bucket object
3030
try:
31-
print('Deleting bucket...')
31+
print('Deleting bucket ...')
3232
response = s3client.delete_bucket(Bucket=bucket_name)
3333
print(response)
34-
print('\nDeleted')
34+
print('Deleted')
3535
except botocore.exceptions.ClientError as e:
3636
if e.response['Error']['Code'] == "NoSuchBucket":
3737
print("Error: Bucket does not exist!!")

awss3delete-rapi/s3delete.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ def main():
1717
# which is the script itself.
1818
args = sys.argv[1:]
1919
if len(args) < 1:
20-
print('Not enough parameters. Proper Usage is: python s3delete.py <BUCKET_NAME>')
20+
print('Not enough parameters.\nProper Usage is: python s3delete.py <BUCKET_NAME>')
2121
sys.exit(1)
2222

2323
bucket_name = args[0]
@@ -31,10 +31,10 @@ def main():
3131

3232
# Delete the bucket object
3333
try:
34-
print('Deleting bucket...')
34+
print('Deleting bucket ...')
3535
response = bucket.delete()
3636
print(response)
37-
print('\nDeleted')
37+
print('Deleted')
3838
except botocore.exceptions.ClientError as e:
3939
if e.response['Error']['Code'] == "NoSuchBucket":
4040
print("Error: Bucket does not exist!!")

awss3download-capi/s3download.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,25 +19,25 @@ def main():
1919
# which is the script itself.
2020
args = sys.argv[1:]
2121
if len(args) < 3:
22-
print('Not enough parameters. Proper Usage is: python s3download.py <BUCKET_NAME> <OBJECT_NAME> <LOCAL_FILE_NAME>')
22+
print('Not enough parameters.\nProper Usage is: python s3download.py <BUCKET_NAME> <OBJECT_NAME> <LOCAL_FILE_NAME>')
2323
sys.exit(1)
2424

2525
bucket_name = args[0]
2626
key_name = args[1]
27-
download_file_name = args[2]
27+
local_file_name = args[2]
2828

2929
print('Bucket: ' + bucket_name)
3030
print('Object/Key: ' + key_name)
31-
print('Local file: ' + download_file_name)
31+
print('Local file: ' + local_file_name)
3232

3333
# Create an S3 Client
3434
s3client = boto3.client('s3')
3535

3636
# Download object
3737
try:
38-
print('Downloading object...')
39-
s3client.download_file(bucket_name, key_name, download_file_name)
40-
print('\nDownloaded')
38+
print('Downloading object ...')
39+
s3client.download_file(bucket_name, key_name, local_file_name)
40+
print('Downloaded')
4141
except botocore.exceptions.ClientError as e:
4242
if e.response['Error']['Code'] == "404":
4343
print("Error: Not Found, problem with the parameters!!")

awss3download-rapi/s3download.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,27 +19,27 @@ def main():
1919
# which is the script itself.
2020
args = sys.argv[1:]
2121
if len(args) < 3:
22-
print('Not enough parameters. Proper Usage is: python s3download.py <BUCKET_NAME> <OBJECT_NAME> <LOCAL_FILE_NAME>')
22+
print('Not enough parameters.\nProper Usage is: python s3download.py <BUCKET_NAME> <OBJECT_NAME> <LOCAL_FILE_NAME>')
2323
sys.exit(1)
2424

2525
bucket_name = args[0]
2626
key_name = args[1]
27-
download_file_name = args[2]
27+
local_file_name = args[2]
2828

2929
print('Bucket: ' + bucket_name)
3030
print('Object/Key: ' + key_name)
31-
print('Local file: ' + download_file_name)
31+
print('Local file: ' + local_file_name)
3232

3333
# Instantiate the service resource object
3434
s3resource = boto3.resource('s3')
3535

3636
try:
3737
# Instantiate the bucket object
3838
bucket = s3resource.Bucket(bucket_name)
39-
print('Downloading object...')
39+
print('Downloading object ...')
4040
# Download object
41-
bucket.download_file(key_name, download_file_name)
42-
print('\nDownloaded')
41+
bucket.download_file(key_name, local_file_name)
42+
print('Downloaded')
4343
except botocore.exceptions.ClientError as e:
4444
if e.response['Error']['Code'] == "404":
4545
print("Error: Not Found, problem with the parameters!!")

awss3list-capi/s3list.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ def main():
1717
# which is the script itself.
1818
args = sys.argv[1:]
1919
if len(args) < 1:
20-
print('Not enough parameters. Proper Usage is: python s3list.py <BUCKET_NAME>')
20+
print('Not enough parameters.\nProper Usage is: python s3list.py <BUCKET_NAME>')
2121
sys.exit(1)
2222

2323
bucket_name = args[0]

awss3list-rapi/s3list.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ def main():
1717
# which is the script itself.
1818
args = sys.argv[1:]
1919
if len(args) < 1:
20-
print('Not enough parameters. Proper Usage is: python s3list.py <BUCKET_NAME>')
20+
print('Not enough parameters.\nProper Usage is: python s3list.py <BUCKET_NAME>')
2121
sys.exit(1)
2222

2323
bucket_name = args[0]

0 commit comments

Comments
 (0)