A python software development kit for the Multi-Chain Storage(MCS) https://www.multichain.storage service. It provides a convenient interface for working with the MCS API.
- via pip (Recommended):
pip install python-mcs-sdk
- Build from source (optional)
git clone https://github.com/filswan/python-mcs-sdk.git
git checkout main
pip install -r requirements.txt
api_key/access_token can be found in https://www.multichain.storage/#/api_key, make sure save your APIKey and Access Token after you have generated it, you will not find it again after you created it
Authentication
from swan_mcs import APIClient
if __name__ == '__main__':
api_key="<API_KEY>"
mcs_api = APIClient(api_key)
- Create a bucket
from swan_mcs import BucketAPI
bucket_client = BucketAPI(mcs_api)
bucket_data = bucket_client.create_bucket('YOUR_BUCKET_NAME')
print(bucket_data)
- Upload a file to the bucket
# file_path is the path relative to the current file
# object_name is your target path. e.g: 'FOLDER_NAME/FILENAME'
file_data = bucket_client.upload_file('YOUR_BUCKET_NAME', 'OBJECT_NAME' , 'FILE_PATH')
print(file_data.to_json())
For more examples, please see the SDK documentation.
This SDK has the following functionalities:
- POST Create a bucket
- POST Create a folder
- POST Upload File to the bucket
- POST Rename bucket
- GET Delete bucket
- GET Bucket List
- GET File List
- GET File information
- GET Delete File
Feel free to join in and discuss. Suggestions are welcome! Open an issue or Join the Discord!
Filecoin Foundation sponsors this project
Flink SDK - A data provider offers Chainlink Oracle service for Filecoin Network