xiliu Aliyun FunctionCompute SDK2
Project description
Overview
The SDK of this version is dependent on the third-party HTTP library requests.
Running environment
Python 3.6+
Installation
Install the official release version through PIP (taking Linux as an example):
$ pip install xl-aliyun-fc2
You can also install the unzipped installer package directly:
$ sudo python setup.py install
Getting started
# -*- coding: utf-8 -*-
import fc2
import zipfile
import base64
# To know the endpoint and access key id/secret info, please refer to:
# https://help.aliyun.com/document_detail/52984.html
client = fc2.Client(
endpoint='<Your Endpoint>',
accessKeyID='<Your AccessKeyID>',
accessKeySecret='<Your AccessKeySecret>')
# Create service.
client.create_service('demo')
zipFileBase64 = ''
with open('file.zip', 'rb') as f:
content = f.read()
zipFileBase64 = base64.b64encode(content).decode()
# Create function.
client.create_function('demo',
{
'functionName':'test_func',
'runtime': 'python3',
'handler': 'index.handler',
'code': {
'zipFile': zipFileBase64
},
'environmentVariables': {'testKey': 'testValue'}
}
)
# Invoke function synchronously.
client.invoke_function('demo', 'test_func')
More resources
Contacting us
License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
xl-aliyun-fc2-0.0.2.tar.gz
(14.2 kB
view details)
Built Distribution
File details
Details for the file xl-aliyun-fc2-0.0.2.tar.gz
.
File metadata
- Download URL: xl-aliyun-fc2-0.0.2.tar.gz
- Upload date:
- Size: 14.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.16
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a1d94374dce435677f4f5cbe6de87d83a36232f157dec60a5f19f2b86e6f05bd |
|
MD5 | 0d73db1e37c97f6cec09bcabee2885ac |
|
BLAKE2b-256 | 27dda1170478e35314e6f6f5bce5b2c8e946357123725857066586cd84ebe529 |
File details
Details for the file xl_aliyun_fc2-0.0.2-py3-none-any.whl
.
File metadata
- Download URL: xl_aliyun_fc2-0.0.2-py3-none-any.whl
- Upload date:
- Size: 14.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.16
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8bf5b3fbdb7c3c2d2b19fb5817ba83b014a0621a0c1d1af29795600eff2cf75f |
|
MD5 | 69f976be92ab30e0b193789d484a812c |
|
BLAKE2b-256 | 1534f7d1376add4d41a516b10993e6d991d518a2617da216e5eb6be7ac4628f6 |