Before you use Content Moderation SDK for Python, you must use pip to install Python dependencies.
Prerequisites
Python 2.x or Python 3.x is used.
Make sure that the python-pip dependency library is installed on the source server.
In the examples, python3-pip is used. Run the following commands to install the python-pip dependency library for specific Linux distributions:
CentOS and Red Hat Enterprise Linux:
yum -y install python3-pip
Ubuntu and Debian:
apt-get -y install python3-pip
OpenSUSE and SUSE:
zypper -n install python3-pip
Install the SDK
Before you install the Alibaba Cloud SDK, make sure that you have downloaded and imported the Extension.Uploader utility class into your project.
If you are using Python 2.x, run the following commands to install the Alibaba Cloud SDK core library:
pip install aliyun-python-sdk-core==2.13.10 pip install -v aliyun-python-sdk-green==3.6.6 // Install the SDK of the specified version. pip install oss2 // Install the Object Storage Service (OSS) dependency.
If you are using Python 3.x, run the following commands to install the Alibaba Cloud SDK core library:
pip install aliyun-python-sdk-core-v3==2.13.10 pip install -v aliyun-python-sdk-green==3.6.6 // Install the SDK of the specified version. pip install oss2 // Install the OSS dependency.
Configure environment variables
In Alibaba Cloud SDK code, you can create a default access credential by defining ALIBABA_CLOUD_ACCESS_KEY_ID
and ALIBABA_CLOUD_ACCESS_KEY_SECRET
environment variables. When you call API operations of Alibaba Cloud services, the system directly accesses the credential, reads your AccessKey pair, and then automatically completes authentication. Before you use the SDK sample code, you must configure environment variables. For more information, see Configure credentials.