{ "info": { "author": "", "author_email": "", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3.6" ], "description": "Aliyun FunctionCompute Python SDK\n=================================\n\n.. image:: https://badge.fury.io/py/aliyun-fc2.svg\n :target: https://badge.fury.io/py/aliyun-fc2\n.. image:: https://travis-ci.org/aliyun/fc-python-sdk.svg?branch=master\n :target: https://travis-ci.org/aliyun/fc-python-sdk\n.. image:: https://coveralls.io/repos/github/aliyun/fc-python-sdk/badge.svg?branch=master\n :target: https://coveralls.io/github/aliyun/fc-python-sdk?branch=master\n\nOverview\n--------\n\nThe SDK of this version is dependent on the third-party HTTP library `requests `_.\n\n\nRunning environment\n-------------------\n\nPython 2.7, Python 3.6\n\n\nNotice\n-------------------\nfc and fc2 are not compatible, now master repo is fc2, if you still use fc, 1.x branch is what you need.\nWe suggest using fc2, The main difference between fc and fc2 is:\n\n1, all http request fuction can set headers\n\n.. code-block:: python\n\n def invoke_function(self, serviceName, functionName, payload=None, \n headers = {'x-fc-invocation-type': 'Sync', 'x-fc-log-type' : 'None'}): \n ...\n\nAttention: abandon async_invoke_function, there is only one function interface invoke_function, distinguish between synchronous and asynchronous by x-fc-invocation-type parameters(Sync or Async).\n\n\n.. code-block:: python\n\n # sync invoke\n client.invoke_function('service_name', 'function_name')\n\n # async invoke\n client.invoke_function('service_name', 'function_name', headers = {'x-fc-invocation-type': 'Async'})\n\n\n\n\n2, The all http response returned by the user is the following object\n\n.. code-block:: python\n\n class FcHttpResponse(object):\n def __init__(self, headers, data):\n self._headers = headers\n self._data = data\n\n @property\n def headers(self):\n return self._headers\n\n @property\n def data(self):\n return self._data\n\nNote: for invoke function, data is bytes, for other apis, data is dict\n\nInstallation\n-------------------\n\nInstall the official release version through PIP (taking Linux as an example):\n\n.. code-block:: bash\n\n $ pip install aliyun-fc2\n\nYou can also install the unzipped installer package directly:\n\n.. code-block:: bash\n\n $ sudo python setup.py install\n\n\nif you still use fc, you can install the official fc1 release version through PIP (taking Linux as an example):\n\n.. code-block:: bash\n\n $ pip install aliyun-fc\n\nGetting started\n-------------------\n\n.. code-block:: python\n\n # -*- coding: utf-8 -*-\n\n import fc2\n\n\n # To know the endpoint and access key id/secret info, please refer to:\n # https://help.aliyun.com/document_detail/52984.html\n client = fc2.Client(\n endpoint='',\n accessKeyID='',\n accessKeySecret='')\n\n # Create service.\n client.create_service('service_name')\n\n # set vpc config when creating the service\n vpcConfig = {\n 'vpcId': '',\n 'vSwitchIds': '<[Your VSwitch Ids]>',\n 'securityGroupId': ''\n }\n\n # create vpcConfig when creating the service\n # you have to set the role if you want to set vpc config\n vpc_role = 'acs:ram::12345678:role/aliyunvpcrole'\n\n # set nas config when creating the service\n nasConfig = {\n \"userId\": '',\n \"groupId\": '',\n \"mountPoints\": [\n {\n \"serverAddrserverAddr\" : '',\n \"mountDir\" : '',\n }\n ],\n }\n\n service = client.create_service(name, role=vpc_role, vpcConfig=vpcConfig, nasConfig=nasConfig)\n\n # Create function.\n # the current directory has a main.zip file (main.py which has a function of myhandler)\n # set environment variables {'testKey': 'testValue'}\n client.create_function('service_name', 'function_name', 'python3', 'main.my_handler', codeZipFile = 'main.zip', environmentVariables = {'testKey': 'testValue'})\n\n # Create function with initailizer\n # main.my_initializer is the entry point of initializer interface\n client.create_function('service_name', 'function_name', 'python3', 'main.my_handler', \"main.my_initializer\", codeZipFile = 'main.zip', environmentVariables = {'testKey': 'testValue'})\n\n # Invoke function synchronously.\n client.invoke_function('service_name', 'function_name')\n\n # Create trigger\n # Create oss trigger\n oss_trigger_config = {\n 'events': ['oss:ObjectCreated:*'],\n 'filter': {\n 'key': {\n 'prefix': 'prefix',\n 'suffix': 'suffix'\n }\n }\n }\n source_arn = 'acs:oss:cn-shanghai:12345678:bucketName'\n invocation_role = 'acs:ram::12345678:role/aliyunosseventnotificationrole'\n client.create_trigger('service_name', 'function_name', 'trigger_name', 'oss',\n oss_trigger_config, source_arn, invocation_role)\n\n # Create log trigger\n log_trigger_config = {\n 'sourceConfig': {\n 'logstore': 'log_store_source'\n },\n 'jobConfig': {\n 'triggerInterval': 60,\n 'maxRetryTime': 10\n },\n 'functionParameter': {},\n 'logConfig': {\n 'project': 'log_project',\n 'logstore': 'log_store'\n },\n 'enable': False\n }\n source_arn = 'acs:log:cn-shanghai:12345678:project/log_project'\n invocation_role = 'acs:ram::12345678:role/aliyunlogetlrole'\n client.create_trigger('service_name', 'function_name', 'trigger_name', 'oss',\n log_trigger_config, source_arn, invocation_role)\n # Create time trigger\n time_trigger_config = {\n 'payload': 'awesome-fc'\n 'cronExpression': '0 5 * * * *'\n 'enable': true\n }\n client.create_trigger('service_name', 'function_name', 'trigger_name', 'timer', time_trigger_config, '', '')\n\n # Invoke a function with a input parameter.\n client.invoke_function('service_name', 'function_name', payload=bytes('hello_world'))\n\n # Read a image and invoke a function with the file data as input parameter.\n src = open('src_image_file_path', 'rb') # Note: please open it as binary.\n r = client.invoke_function('service_name', 'function_name', payload=src)\n # save the result as the output image.\n dst = open('dst_image_file_path', 'wb')\n dst.write(r.data)\n src.close()\n dst.close()\n\n # Invoke function asynchronously.\n client.invoke_function('service_name', 'function_name', headers = {'x-fc-invocation-type': 'Async'})\n\n # List services.\n client.list_services()\n\n # List functions with prefix and limit.\n client.list_functions('service_name', prefix='the_prefix', limit=10)\n\n # Delete service.\n client.delete_service('service_name')\n\n # Delete function.\n client.delete_function('service_name', 'function_name')\n\n\nTesting\n-------\n\nTo run the tests, please set the access key id/secret, endpoint as environment variables.\nTake the Linux system for example:\n\n.. code-block:: bash\n\n $ export ENDPOINT=\n $ export ACCESS_KEY_ID=\n $ export ACCESS_KEY_SECRET=\n $ export STS_TOKEN=\n\nRun the test in the following method:\n\n.. code-block:: bash\n\n $ nosetests # First install nose\n\nMore resources\n--------------\n- `Aliyun FunctionCompute docs `_\n\nContacting us\n-------------\n- `Links `_\n\nLicense\n-------\n- `MIT `_", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://www.aliyun.com/product/fc", "keywords": "", "license": "", "maintainer": "", "maintainer_email": "", "name": "aliyun-fc2", "package_url": "https://pypi.org/project/aliyun-fc2/", "platform": "", "project_url": "https://pypi.org/project/aliyun-fc2/", "project_urls": { "Homepage": "https://www.aliyun.com/product/fc" }, "release_url": "https://pypi.org/project/aliyun-fc2/2.3.0/", "requires_dist": null, "requires_python": "", "summary": "Aliyun FunctionCompute SDK2", "version": "2.3.0" }, "last_serial": 5806607, "releases": { "2.0.1": [ { "comment_text": "", "digests": { "md5": "54d4cf3c79dd4655d4898d71095b49db", "sha256": "150e497b9decfaaa6887d2cadaa79cb51ecdd1cd7eb056ad7b9991e2e497810e" }, "downloads": -1, "filename": "aliyun-fc2-2.0.1.tar.gz", "has_sig": false, "md5_digest": "54d4cf3c79dd4655d4898d71095b49db", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10475, "upload_time": "2017-12-01T07:43:14", "url": "https://files.pythonhosted.org/packages/c5/58/0a7df7c1c3dbbeea708cef42e34742026d6f38b6383d4f64c42eb67d9ab8/aliyun-fc2-2.0.1.tar.gz" } ], "2.0.10": [ { "comment_text": "", "digests": { "md5": "16b32616564033fcc9848e64d8639fac", "sha256": "85eb4342192c8606a5a5c1513faa42d31419717b6c385c7cdb06c8a631228230" }, "downloads": -1, "filename": "aliyun-fc2-2.0.10.tar.gz", "has_sig": false, "md5_digest": "16b32616564033fcc9848e64d8639fac", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 14099, "upload_time": "2018-09-21T09:56:58", "url": "https://files.pythonhosted.org/packages/de/3e/27c4475ced51c704d514f3a790ffd831a6bad6fd26e5c0024f14613ae78e/aliyun-fc2-2.0.10.tar.gz" } ], "2.0.11": [ { "comment_text": "", "digests": { "md5": "50abdd08d032004fed7e3515f6d77ae1", "sha256": "c36d5292265944bff389d82fed366589ea2a89b4e486ab1d7acc20d37c2f81c1" }, "downloads": -1, "filename": "aliyun-fc2-2.0.11.tar.gz", "has_sig": false, "md5_digest": "50abdd08d032004fed7e3515f6d77ae1", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 15357, "upload_time": "2018-10-26T09:37:43", "url": "https://files.pythonhosted.org/packages/64/c7/1f06b004a30f7edfb24d90ef46a7a0b48583ba158331b10d3970fedce503/aliyun-fc2-2.0.11.tar.gz" } ], "2.0.2": [ { "comment_text": "", "digests": { "md5": "859a954bd9182fc20904280301bb1f73", "sha256": "08131c7a6ffe82bfde031f72df66d41ff545699a1ff5e504c02bc9a2f8023476" }, "downloads": -1, "filename": "aliyun-fc2-2.0.2.tar.gz", "has_sig": false, "md5_digest": "859a954bd9182fc20904280301bb1f73", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10129, "upload_time": "2017-12-13T02:48:52", "url": "https://files.pythonhosted.org/packages/07/81/572127427bc924894104874646de6d3601c856f69e1f695d6ac2d3a30cc9/aliyun-fc2-2.0.2.tar.gz" } ], "2.0.3": [ { "comment_text": "", "digests": { "md5": "5f6a7bc5df62cd351a012f5f1eb59852", "sha256": "43f3d5d28745f02c4ca490476f4d0ce15d8e6f4244a7e9966c55d16bf4ba1018" }, "downloads": -1, "filename": "aliyun-fc2-2.0.3.tar.gz", "has_sig": false, "md5_digest": "5f6a7bc5df62cd351a012f5f1eb59852", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10353, "upload_time": "2018-01-10T08:28:24", "url": "https://files.pythonhosted.org/packages/96/6a/ab9e31b44c49e53bc2f20eb87cbc921436e9845a9b3d2227d3a39908fde1/aliyun-fc2-2.0.3.tar.gz" } ], "2.0.4": [ { "comment_text": "", "digests": { "md5": "09c5529820cc2fac40bf65e31cd39952", "sha256": "3a9e0bc2c9ee682915985768802d8dc417457dcf8850d60a36aa23d836daf537" }, "downloads": -1, "filename": "aliyun-fc2-2.0.4.tar.gz", "has_sig": false, "md5_digest": "09c5529820cc2fac40bf65e31cd39952", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11194, "upload_time": "2018-02-11T11:51:49", "url": "https://files.pythonhosted.org/packages/29/17/e1e8bbfa3cd4d03deb532472c1fc30e608b583fbfbc6e438ee2db27668f8/aliyun-fc2-2.0.4.tar.gz" } ], "2.0.5": [ { "comment_text": "", "digests": { "md5": "487dfce6bde30105ae9e52fe72d1a056", "sha256": "36b6f4162b9e14eff3e89c9be8378a91c7a682846c94f59e03e9fac35a446240" }, "downloads": -1, "filename": "aliyun-fc2-2.0.5.tar.gz", "has_sig": false, "md5_digest": "487dfce6bde30105ae9e52fe72d1a056", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11394, "upload_time": "2018-04-12T12:05:05", "url": "https://files.pythonhosted.org/packages/b7/05/3ba05097f3d2d1698185ccd248dcbb9828a5dc557f68d1ece8cad08a33b2/aliyun-fc2-2.0.5.tar.gz" } ], "2.0.6": [ { "comment_text": "", "digests": { "md5": "1803af0172b054bc9f57f903c47ff716", "sha256": "0a648424cba405ac4cf217b04a53c888d4a5d6cb99f1f014f7ad66b11185eb29" }, "downloads": -1, "filename": "aliyun-fc2-2.0.6.tar.gz", "has_sig": false, "md5_digest": "1803af0172b054bc9f57f903c47ff716", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12665, "upload_time": "2018-05-23T12:23:18", "url": "https://files.pythonhosted.org/packages/ca/3d/c35189cdc2774826d696ebbd049be7ec34ffe38e05eb48c6b717ef30cb62/aliyun-fc2-2.0.6.tar.gz" } ], "2.0.7": [ { "comment_text": "", "digests": { "md5": "6fa3485d7d2e5fd8ac820e85495706ae", "sha256": "93c98822e6c4a8f3d0981c1e688b7914b33961a951bda8cfb16740d7f59cc3d8" }, "downloads": -1, "filename": "aliyun-fc2-2.0.7.tar.gz", "has_sig": false, "md5_digest": "6fa3485d7d2e5fd8ac820e85495706ae", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12760, "upload_time": "2018-05-24T11:47:37", "url": "https://files.pythonhosted.org/packages/04/f9/ea0fa229f171325c911e9cb332747dc3550760ec03dc1ee084d05caeff39/aliyun-fc2-2.0.7.tar.gz" } ], "2.0.8": [ { "comment_text": "", "digests": { "md5": "010f3e6da307a2c0127295b9cb9739b9", "sha256": "beea1d31fe4276b503bcbc0f3f0aac5da9aad01ef0f340ac651d5530d71cc58a" }, "downloads": -1, "filename": "aliyun-fc2-2.0.8.tar.gz", "has_sig": false, "md5_digest": "010f3e6da307a2c0127295b9cb9739b9", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13315, "upload_time": "2018-07-14T07:15:52", "url": "https://files.pythonhosted.org/packages/9b/45/d50ac3e6daae660b40c606050b94c19973771eb6c7f581f1968ceb78299c/aliyun-fc2-2.0.8.tar.gz" } ], "2.0.9": [ { "comment_text": "", "digests": { "md5": "23eb4943cc848d13bf27d7a477e6bf0e", "sha256": "5fedc7a2a8aad7f625b5d4849ef1a7f09ce314682b7aa944f2e8cbb414e64ee9" }, "downloads": -1, "filename": "aliyun-fc2-2.0.9.tar.gz", "has_sig": false, "md5_digest": "23eb4943cc848d13bf27d7a477e6bf0e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13618, "upload_time": "2018-08-20T06:32:56", "url": "https://files.pythonhosted.org/packages/a7/dc/25c1a4b7f6120b39628afebaaa57cdd9bb8e96dca529a4390024e1f1570f/aliyun-fc2-2.0.9.tar.gz" } ], "2.1.0": [ { "comment_text": "", "digests": { "md5": "bc4f8e7c85911ef907e92a637f19cb57", "sha256": "182bfe8c33041a1cb5bdeb9c54aef1119c26bd0219cf7958788ed2f68ecdcd3c" }, "downloads": -1, "filename": "aliyun-fc2-2.1.0.tar.gz", "has_sig": false, "md5_digest": "bc4f8e7c85911ef907e92a637f19cb57", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 15365, "upload_time": "2018-11-20T02:35:35", "url": "https://files.pythonhosted.org/packages/98/aa/71da4f6f77ed686b1f89045e9b07534f5c8580273ea0ef154a91c7b776bf/aliyun-fc2-2.1.0.tar.gz" } ], "2.2.0": [ { "comment_text": "", "digests": { "md5": "55592bb1af4cbb37b6fc046be6d306a3", "sha256": "8191cdabae9a5c0156c06e1159c5c91289ce443b78b7f973c6925a3e4863df12" }, "downloads": -1, "filename": "aliyun-fc2-2.2.0.tar.gz", "has_sig": false, "md5_digest": "55592bb1af4cbb37b6fc046be6d306a3", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13172, "upload_time": "2019-07-26T03:03:01", "url": "https://files.pythonhosted.org/packages/64/bc/d53224bc75cbbbba866ea1310690653d0f49b728d18788c44a6a964479cc/aliyun-fc2-2.2.0.tar.gz" } ], "2.3.0": [ { "comment_text": "", "digests": { "md5": "106ac07972401e966ac6c116ca63fc3d", "sha256": "0078799194c716ddda5a1876c2e03f4cdca57e583e32cde602885330e863976e" }, "downloads": -1, "filename": "aliyun-fc2-2.3.0.tar.gz", "has_sig": false, "md5_digest": "106ac07972401e966ac6c116ca63fc3d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 14196, "upload_time": "2019-09-10T02:52:16", "url": "https://files.pythonhosted.org/packages/65/9f/7f904b27b68734679719ab7e0f798b06c791a96cfaae0bec7404feeb8d24/aliyun-fc2-2.3.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "106ac07972401e966ac6c116ca63fc3d", "sha256": "0078799194c716ddda5a1876c2e03f4cdca57e583e32cde602885330e863976e" }, "downloads": -1, "filename": "aliyun-fc2-2.3.0.tar.gz", "has_sig": false, "md5_digest": "106ac07972401e966ac6c116ca63fc3d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 14196, "upload_time": "2019-09-10T02:52:16", "url": "https://files.pythonhosted.org/packages/65/9f/7f904b27b68734679719ab7e0f798b06c791a96cfaae0bec7404feeb8d24/aliyun-fc2-2.3.0.tar.gz" } ] }