1. Set up the python-MCS-SDK

To begin using Swan Storage, you need to install and configure the python-MCS-SDK.

1.1 Install Python

Ensure you have Python 3.7 or later installed on your system.

For information about how to get the latest version of Python, see the official Python documentation.

1.2 Install python-MCS-SDK

Install the latest python-MCS-SDK release via pip:

pip install python-MCS-SDK

The latest development version of python-MCS-SDK is on GitHub

1.3 Configure the SDK

Before using the SDK, you need to generate an API key from the MCS website.

  1. Generate an API key and Access Token

  2. Save your API key and Access Token securely

1.4 Initialize the SDK

To use python-MCS-SDK, you must first import it and state your identity.

from swan_mcs import APIClient
# Let's initialize the Python-MCS-SDK
mcs_api = APIClient("<API_KEY>", "<ACCESS_TOKEN>", "<CHAIN_NAME>")
# polygon.mainnet for mainnet, polygon.mumbai for testnet

If you see "Login Successful" in the console, you have logged in successfully. Now you can choose which service you want to initialize: Onchain or Buckets. The following code will take you through the initialization of both services.

from swan_mcs import BucketAPI, OnchainAPI
# Init bucket client
bucket_client = BucketAPI(mcs_api)
# Init onchain client
onchain_client = OnchainAPI(mcs_api)

Last updated