471,117 Members | 1,171 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,117 software developers and data experts.

A question about Alibaba Cloud OSS python SDK

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
2 1625
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
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.

Similar topics

reply views Thread by IvanH | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.