Fix boto syntax

Boto library is changed, so an example need to be updated.
- Change boto.s3.Connection to boto.s3.connection.S3Connection, it's the
  right syntax.
- Remove calling_format arg, is unnecessary and in some cases, it doesn't
  works. Default calling_format(DefaultCallingFormat) worked fine.
- Update an example client using boto3 library.
- Note libraries version.

Change-Id: If02edd337e451aff257fa9db920f2bfbf230d924
Closes-Bug: #1660387
This commit is contained in:
Kien Nguyen 2017-01-31 00:07:09 +07:00 committed by Anne Gentle
parent 8e1303cea5
commit bc3dffde40

View File

@ -78,15 +78,38 @@ To set up your client, ensure you are using the ec2 credentials, which
can be downloaded from the API Endpoints tab of the dashboard. The host
should also point to the Object Storage node's hostname. It also will
have to use the old-style calling format, and not the hostname-based
container format. Here is an example client setup using the Python boto
library on a locally installed all-in-one Object Storage installation.
container format. Here are two examples of client setup using both Python
boto_ library (version 2.45.0) and boto3_(version 1.4.4) library on a locally
installed all-in-one Object Storage installation.
.. code-block:: python
connection = boto.s3.Connection(
# Connection using boto library
connection = boto.s3.connection.S3Connection(
aws_access_key_id='a7811544507ebaf6c9a7a8804f47ea1c',
aws_secret_access_key='a7d8e981-e296-d2ba-cb3b-db7dd23159bd',
port=8080,
host='127.0.0.1',
is_secure=False,
calling_format=boto.s3.connection.OrdinaryCallingFormat())
is_secure=False)
# Connection using boto3 library
# Create a low-level service client
s3_client = boto3.client(
's3',
aws_access_key_id='a7811544507ebaf6c9a7a8804f47ea1c',
aws_secret_access_key='a7d8e981-e296-d2ba-cb3b-db7dd23159bd',
endpoint_url='http://127.0.0.1:8080'
)
# Create a resource service client
s3_resource = boto3.resource(
's3',
aws_access_key_id='a7811544507ebaf6c9a7a8804f47ea1c',
aws_secret_access_key='a7d8e981-e296-d2ba-cb3b-db7dd23159bd',
endpoint_url='http://127.0.0.1:8080'
)
.. _boto: https://github.com/boto/boto
.. _boto3: https://github.com/boto/boto3/