By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,451 Members | 981 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,451 IT Pros & Developers. It's quick & easy.

A question about Alibaba Cloud OSS python SDK

P: 22
I have a question about OSS python SDK. Does a directory exists, and if so, how can I represent the directory?
path_exist = bucket.object_exists('release/plugins/')
I wrote the code above, but the returned result states that it does not exist.
Mar 27 '18 #1
Share this Question
Share on Google+
2 Replies


P: 2
Alibaba Cloud Object Storage Python SDK 2.x. This version is not compatible with the previous version (Version 0.x). The package name is oss2 to avoid conflict with previous versions. The SDK of this version is dependent on the third-party HTTP library requests and crcmod. Install the SDK following the methods below
Mar 27 '18 #2

P: 51
This service is introduced only on Alibaba Cloud Object Storage Service (OSS) V2.0. In V1.0, image resources are mainly stored in the specific directories of Alibaba Cloud ECS hosts.
During each system upgrade, data backup is required. A large part of the backup data is image resource files. Starting from the v2.0, Alibaba Cloud stores the image resources and web resources and other data used in applications on the OSS. Therefore, when data backup is required during each system upgrade, it is not necessary to backup image resource files, thus reducing the size of backup files and the backup time.
After OSS is used, image resource files generated by v1.0 need to be completely migrated to OSS. OSS provides SDKs for Python for operating OSS. Therefore, python is used as the development tool to migrate image resource files.
The development environment is CentOS 6.4.
1. Check python development environment
Run the command on the console: python
If the output content is: command not found, it indicates that python is not installed. Install python with the command: yum install python. After the command is executed, the installation starts.
2. Check whether pip and setuptools exist
pip and setuptools are python package management tool. Run pip. If the command does not exist, you must install it. In centos, currently the two tools cannot be directly installed with yum. You can download get-pip.py script in the following link:https://pip.pypa.io/en/stable/installing/. Use the command: python get-pip.py to complete the installation of pip and setuptools.
3. Install oss2
The latest oss sdk is oss2 which is incompatible with previous versions. Run the command: pip install oss2 to complete the installation of oss2.
4. Check whether the oss2 environment is configured
Enter the command: python
Enter the following command: import oss2 and press Enter.
The preceding output content indicates that oss2 development environment is successfully created.
Mar 28 '18 #3

Post your reply

Sign in to post your reply or Sign up for a free account.