This topic describes the download sources and sample code of Simple Message Queue (SMQ, formerly MNS) SDK for Python.
Download sources
Select a version based on your business requirements before you download SMQ SDK for Python. SMQ allows you to download SDK packages from PyPI and provides source sample code at GitHub.
Source | Description |
PyPI | PyPI provides the source code packages of SMQ SDK for Python that you can download. You can obtain the required version of SMQ SDK for Python from PyPI. For more information, see aliyun-mns-sdk. |
GitHub | GitHub provides the source sample code of SMQ SDK for Python and records tag information about the released versions of SMQ SDK. You can view the source code and sample code that you can use in various scenarios at GitHub. For more information, see aliyun-mns-python-sdk. |
In this example, SMQ SDK for Python 1.2.0 is used. For more information, see Versions.
We recommend that you use the latest version of SMQ SDK for Python for debugging.
The Account, Queue, Topic, and Subscription structures in the SDK for Python are not thread-safe. You must independently create instances in multi-threading scenarios.
Sample code
SMQ SDK for Python provides a variety of sample code files for your reference or use. The following table describes the sample code files provided by SMQ SDK for Python.
Type | Content | References | Demo download |
Queue | Create a queue | ||
Delete a queue | |||
Send a message | |||
Receive and consume a message | |||
Topic | Create a topic | ||
Create a subscription whose downstream is a queue | |||
Delete a topic | |||
Publish a message |