| OLD | NEW |
| 1 .. _s3_tut: | 1 .. _s3_tut: |
| 2 | 2 |
| 3 ====================================== | 3 ====================================== |
| 4 An Introduction to boto's S3 interface | 4 An Introduction to boto's S3 interface |
| 5 ====================================== | 5 ====================================== |
| 6 | 6 |
| 7 This tutorial focuses on the boto interface to the Simple Storage Service | 7 This tutorial focuses on the boto interface to the Simple Storage Service |
| 8 from Amazon Web Services. This tutorial assumes that you have already | 8 from Amazon Web Services. This tutorial assumes that you have already |
| 9 downloaded and installed boto. | 9 downloaded and installed boto. |
| 10 | 10 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 >>> conn = boto.connect_s3() | 34 >>> conn = boto.connect_s3() |
| 35 | 35 |
| 36 In either case, conn will point to an S3Connection object which we will | 36 In either case, conn will point to an S3Connection object which we will |
| 37 use throughout the remainder of this tutorial. | 37 use throughout the remainder of this tutorial. |
| 38 | 38 |
| 39 Creating a Bucket | 39 Creating a Bucket |
| 40 ----------------- | 40 ----------------- |
| 41 | 41 |
| 42 Once you have a connection established with S3, you will probably want to | 42 Once you have a connection established with S3, you will probably want to |
| 43 create a bucket. A bucket is a container used to store key/value pairs | 43 create a bucket. A bucket is a container used to store key/value pairs |
| 44 in S3. A bucket can hold un unlimited about of data so you could potentially | 44 in S3. A bucket can hold an unlimited amount of data so you could potentially |
| 45 have just one bucket in S3 for all of your information. Or, you could create | 45 have just one bucket in S3 for all of your information. Or, you could create |
| 46 separate buckets for different types of data. You can figure all of that out | 46 separate buckets for different types of data. You can figure all of that out |
| 47 later, first let's just create a bucket. That can be accomplished like this: | 47 later, first let's just create a bucket. That can be accomplished like this: |
| 48 | 48 |
| 49 >>> bucket = conn.create_bucket('mybucket') | 49 >>> bucket = conn.create_bucket('mybucket') |
| 50 Traceback (most recent call last): | 50 Traceback (most recent call last): |
| 51 File "<stdin>", line 1, in ? | 51 File "<stdin>", line 1, in ? |
| 52 File "boto/connection.py", line 285, in create_bucket | 52 File "boto/connection.py", line 285, in create_bucket |
| 53 raise S3CreateError(response.status, response.reason) | 53 raise S3CreateError(response.status, response.reason) |
| 54 boto.exception.S3CreateError: S3Error[409]: Conflict | 54 boto.exception.S3CreateError: S3Error[409]: Conflict |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 236 | 236 |
| 237 This code associates two metadata key/value pairs with the Key k. To retrieve | 237 This code associates two metadata key/value pairs with the Key k. To retrieve |
| 238 those values later: | 238 those values later: |
| 239 | 239 |
| 240 >>> k = b.get_key('has_metadata) | 240 >>> k = b.get_key('has_metadata) |
| 241 >>> k.get_metadata('meta1') | 241 >>> k.get_metadata('meta1') |
| 242 'This is the first metadata value' | 242 'This is the first metadata value' |
| 243 >>> k.get_metadata('meta2') | 243 >>> k.get_metadata('meta2') |
| 244 'This is the second metadata value' | 244 'This is the second metadata value' |
| 245 >>> | 245 >>> |
| OLD | NEW |