Skip to main content

This is callFunction for SCF.

Project description

tencent-serverless-python

GitHub license

腾讯云云函数SDK,集成云函数业务流接口

Install

pip install https://github.com/alanoluo/tencent-serverless-python/blob/master/dist/tencentserverless-0.1.0-py2.py3-none-any.whl

Example01

本地测试:

from tencentserverless import scf

try:
    data = scf.invoke('test',secret_id="your secret id",
           secret_key="your secret key", data={"a":"b"})
    print data
except Exception,e:
    print e

云函数环境测试:

from tencentserverless.scf import invoke

try:
    data = invoke('test', data={"a":"b"})
    print data
except Exception,e:
    print e

Example02

本地测试:

from tencentserverless.scf import client

scf = client(secret_id="your secret id",
           secret_key="your secret key")

try:
    data = scf.invoke('test',data={"a":"b"})
    print data
except Exception,e:
    print e

云函数环境测试:

from tencentserverless.scf import client

scf = client()

try:
    data = scf.invoke('test',data={"a":"b"})
    print data
except Exception,e:
    print e

API Reference

client

  • [init]

Params:

参数名 是否必填 类型 描述
region string 地域信息,默认与调用接口的函数所属地域相同,本地调用默认是广州
secret_id string 用户 secret_id, 默认是从云函数环境变量中获取,本地调试必填
secret_key string 用户 secret_key, 默认是从云函数环境变量中获取,本地调试必填
token string 用户 token,默认是从云函数环境变量中获取
  • [invoke]

Params:

参数名 是否必填 类型 描述
function_name string 函数名称
qualifier string 函数版本,默认为$LATEST
data 对象 函数运行入参,必须可以被json.dumps的对象
namespace string 命名空间,默认为default

Invoke

调用函数。暂时只支持同步调用。

Params:

参数名 是否必填 类型 描述
region string 地域信息,默认与调用接口的函数所属地域相同,本地调用默认是广州
secret_id string 用户 secret_id, 默认是从云函数环境变量中获取,本地调试必填
secret_key string 用户 secret_key, 默认是从云函数环境变量中获取,本地调试必填
token string 用户 token,默认是从云函数环境变量中获取
:------------ :------: :----: ----------------------:
function_name string 函数名称
qualifier string 函数版本,默认为$LATEST
data string 函数运行入参,必须可以被json.dumps的对象
namespace string 命名空间,默认为default

TODO List

  • 支持管理流接口

Licence

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tencentserverless-0.1.1.tar.gz (4.1 kB view details)

Uploaded Source

File details

Details for the file tencentserverless-0.1.1.tar.gz.

File metadata

  • Download URL: tencentserverless-0.1.1.tar.gz
  • Upload date:
  • Size: 4.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/2.7.5

File hashes

Hashes for tencentserverless-0.1.1.tar.gz
Algorithm Hash digest
SHA256 616a92529cc49e4cd38eee12ad5431935c51cc79cdc599bd39e9f76cf51f4253
MD5 69073ea9f4ce83487064d09a9f825361
BLAKE2b-256 4ad3d5980f9e82cddee91eb95528d253685d995bbd42698fcee2c215e9987ee3

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page