Skip to content
This repository was archived by the owner on May 29, 2025. It is now read-only.

Commit db73837

Browse files
author
Andrew Fitz Gibbon
committed
Add basic sample scripts
1 parent 1cebf2b commit db73837

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

sample.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Import the SDK
2+
import boto
3+
import uuid
4+
5+
# Create an S3 client
6+
s3 = boto.connect_s3()
7+
8+
# Create a new bucket.
9+
bucket_name = "python-sdk-sample-" + str(uuid.uuid4())
10+
print "Creating new bucket with name: " + bucket_name
11+
bucket = s3.create_bucket(bucket_name)
12+
13+
# Upload some data
14+
from boto.s3.key import Key
15+
k = Key(bucket)
16+
k.key = 'hello_world.txt'
17+
18+
print "Uploading some data to " + bucket_name + " with key: " + k.key
19+
k.set_contents_from_string('This is a test of S3. Hellow World!')

0 commit comments

Comments
 (0)