doc/rgw: update to python3 print syntax

python3 requires parens for a `print` statement

Signed-off-by: Michael Fritch <mfritch@suse.com>
This commit is contained in:
Michael Fritch 2021-04-15 15:34:02 -06:00
parent dc94eeddc1
commit e1023aa65e
No known key found for this signature in database
GPG Key ID: 75F3EB2E80A03B7F
4 changed files with 12 additions and 12 deletions

View File

@ -159,10 +159,10 @@ Keystone.
bucket = s3client.create_bucket(Bucket='my-new-shiny-bucket')
response = s3client.list_buckets()
for bucket in response["Buckets"]:
print "{name}\t{created}".format(
print("{name}\t{created}".format(
name = bucket['Name'],
created = bucket['CreationDate'],
)
))
Similar steps can be performed for using GetSessionToken with LDAP.

View File

@ -33,10 +33,10 @@ This also prints out the bucket name and creation date of each bucket.
.. code-block:: python
for bucket in conn.get_all_buckets():
print "{name}\t{created}".format(
print("{name}\t{created}".format(
name = bucket.name,
created = bucket.creation_date,
)
))
The output will look something like this::
@ -65,11 +65,11 @@ modified date.
.. code-block:: python
for key in bucket.list():
print "{name}\t{size}\t{modified}".format(
print("{name}\t{size}\t{modified}".format(
name = key.name,
size = key.size,
modified = key.last_modified,
)
))
The output will look something like this::
@ -158,11 +158,11 @@ URL will stop working).
hello_key = bucket.get_key('hello.txt')
hello_url = hello_key.generate_url(0, query_auth=False, force_http=True)
print hello_url
print(hello_url)
plans_key = bucket.get_key('secret_plans.txt')
plans_url = plans_key.generate_url(3600, query_auth=True, force_http=True)
print plans_url
print(plans_url)
The output of this will look something like::
@ -177,7 +177,7 @@ For example, unordered list of objects could be fetched using:
.. code-block:: python
print conn.list_objects(Bucket='my-new-bucket', AllowUnordered=True)
print(conn.list_objects(Bucket='my-new-bucket', AllowUnordered=True))
Without the extensions file, in the above example, boto3 would complain that the ``AllowUnordered`` argument is invalid.

View File

@ -54,7 +54,7 @@ This gets a list of containers that you own, and prints out the container name:
.. code-block:: python
for container in conn.get_account()[1]:
print container['name']
print(container['name'])
The output will look something like this::
@ -71,7 +71,7 @@ object's name, the file size, and last modified date:
.. code-block:: python
for data in conn.get_container(container_name)[1]:
print '{0}\t{1}\t{2}'.format(data['name'], data['bytes'], data['last_modified'])
print('{0}\t{1}\t{2}'.format(data['name'], data['bytes'], data['last_modified']))
The output will look something like this::

View File

@ -95,7 +95,7 @@ A sample python script to demonstrate the above is given below:
sig = hmac.new(key, hmac_body, sha1).hexdigest()
rest_uri = "{host}{path}?temp_url_sig={sig}&temp_url_expires={expires}".format(
host=host, path=path, sig=sig, expires=expires)
print rest_uri
print(rest_uri)
# Example Output
# https://objectstore.example.com/swift/v1/your-bucket/your-object?temp_url_sig=ff4657876227fc6025f04fcf1e82818266d022c6&temp_url_expires=1423200992