You can configure a progress bar to display the progress of an upload or download task.

Sample code

The following code provides an example on how to use a progress bar when you call bucket.put_object to upload an object:

# -*- coding: utf-8 -*-
from __future__ import print_function
import os, sys
import oss2# The AccessKey pair of an Alibaba Cloud account has permissions on all API operations. Using these credentials to perform operations in OSS is a high-risk operation. We recommend that you use a RAM user to call API operations or perform routine O&M. To create a RAM user, log on to the RAM console. 
auth = oss2.Auth('yourAccessKeyId', 'yourAccessKeySecret')
# Specify the endpoint of the region in which the bucket is located. For example, if the bucket is located in the China (Hangzhou) region, set the endpoint to https://oss-cn-hangzhou.aliyuncs.com. 
# Set yourBucketName to the name of the bucket. 
bucket = oss2.Bucket(auth, 'https://oss-cn-hangzhou.aliyuncs.com', 'yourBucketName')
# If the length of the data to upload cannot be determined, the value of total_bytes is None. 
def percentage(consumed_bytes, total_bytes):
    if total_bytes:
        rate = int(100 * (float(consumed_bytes) / float(total_bytes)))
        print('\r{0}% '.format(rate), end='')
        sys.stdout.flush()
# (Optional) The progress_callback parameter is used to return progress information. 
bucket.put_object('yourObjectName', 'a'*1024*1024, progress_callback=percentage)

References

For the complete sample code of progress bars in object upload, visit GitHub.