A question about Alibaba Cloud OSS python SDK

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • TimoHa
    New Member
    • Nov 2017
    • 22

    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_e xists('release/plugins/')
    I wrote the code above, but the returned result states that it does not exist.
  • johnedword
    New Member
    • Mar 2018
    • 2

    #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
    Last edited by Rabbit; Mar 27 '18, 04:41 PM. Reason: Ad link removed

    Comment

    • IvanH
      New Member
      • Nov 2017
      • 51

      #3
      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.

      Comment

      Working...