Skip to main content

Aliyun FunctionCompute SDK

Project description

Aliyun FunctionCompute Python SDK

.. image::
.. image::
.. image::


The SDK of this version is dependent on the third-party HTTP library `requests <>`_.

Running environment

Python 2.7, Python 3.6


Install the official release version through PIP (taking Linux as an example):

.. code-block:: bash

$ pip install aliyun-fc

You can also install the unzipped installer package directly:

.. code-block:: bash

$ sudo python install

Getting started

.. code-block:: python

# -*- coding: utf-8 -*-

import fc

# To know the endpoint and access key id/secret info, please refer to:
client = fc.Client(
endpoint='<Your Endpoint>',
accessKeyID='<Your AccessKeyID>',
accessKeySecret='<Your AccessKeySecret>')

# Create service.

# Create function.
# the current directory has a file ( which has a function of myhandler)
client.create_function('service_name', 'function_name', 'main.my_handler', codeZipFile = '')

# Invoke function synchronously.
client.invoke_function('service_name', 'function_name')

# Invoke a function with a input parameter.
client.invoke_function('service_name', 'function_name', payload=bytes('hello_world'))

# Read a image and invoke a function with the file data as input parameter.
src = open('src_image_file_path', 'rb') # Note: please open it as binary.
r = client.invoke_function('service_name', 'function_name', payload=src)
# save the result as the output image.
dst = open('dst_image_file_path', 'wb')

# Invoke function asynchronously.
client.async_invoke_function('service_name', 'function_name')

# List services.

# List functions with prefix and limit.
client.list_functions('service_name', prefix='the_prefix', limit=10)

# Delete service.

# Delete function.
client.delete_function('service_name', 'function_name')


To run the tests, please set the access key id/secret, endpoint as environment variables.
Take the Linux system for example:

.. code-block:: bash

$ export ENDPOINT=<endpoint>
$ export ACCESS_KEY_ID=<AccessKeyId>
$ export ACCESS_KEY_SECRET=<AccessKeySecret>
$ export STS_TOKEN=<roleARN>

Run the test in the following method:

.. code-block:: bash

$ nosetests # First install nose

More resources
- `Aliyun FunctionCompute docs <>`_

Contacting us
- `Links <>`_

- `MIT <>`_

Project details

Release history Release notifications

This version
History Node


History Node


History Node


History Node


History Node


Download files

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

Filename, size & hash SHA256 hash help File type Python version Upload date
aliyun-fc-0.6.tar.gz (9.2 kB) Copy SHA256 hash SHA256 Source None Nov 14, 2017

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging CloudAMQP CloudAMQP RabbitMQ AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page