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('service_name')
zipFileBase64 = ''
with zipfile.ZipFile('file.zip', 'r') as archive:
content = archive.read()
zipFileBase64 = base64.b64encode(content).decode('utf-8')
# Create function.
client.create_function('service_name', {
'functionName':'python3',
'runtime': 'main.my_handler',
'code': {
'zipFile': zipFileBase64
},
'environmentVariables': {'testKey': 'testValue'}
})
# Invoke function synchronously.
client.invoke_function('service_name', 'function_name')
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.1.tar.gz
(14.2 kB
view hashes)
Built Distribution
Close
Hashes for xl_aliyun_fc2-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7c0ad0a2b50450656f4e40d5234090ce1c87a9eadd28844af9ab4cc492c8772d |
|
MD5 | e8f118fa480b45b8c7cce3e630e6f38c |
|
BLAKE2b-256 | a5662c186b192cbe3db0b2be83cba313aa84fd0487311c3953dd368dd53fed84 |