Skip to main content

SDK for python serverless functions

Project description

Serverless cloud functions

Contents

  1. Quick Start
  2. Examples
  3. Features
  4. Community
  5. Licensing

Quick Start

  1. Install via pip:
    pip install sels8s
    
  2. Download rc.sh file from Selectel panel
  3. Set environment variables: -OS_USERNAME - your username in panel -OS_PASSWORD - your password -OS_PROJECT_ID - your project id -OS_PROJECT_DOMAIN_NAME - your project domain name -OS_USER_DOMAIN_NAME - your user domain name
  4. Create your own cloud function:
    import sels8s
    
    serverless = sels8s.Serverless()
    
    # upload file
    module = serverless.upload_module('/home/my_file.py')
    
    # create function
    serverless.create_function('my_function')
    
    # add your code and params
    module_id = module.json()["function_id"]
    
    serverless.edit_function('my_function', function_id=module_id,
                             function_name='name_of_function_in_code',
                             module_name='my_file.py', env_vars={'key':'value'},
                             runtime='python', version='3.7')
    
    # invoke your function
    activation = serverless.invoke_function('my_function')
    
    # get logs and results
    logs = serverless.get_activation_logs(activation['activation_id'])
    result = serverless.get_activation_result(activation['activation_id'])
    

Examples

You can see examples of using cloud functions here

Features

Cloud functions

Docs

Community

GitHub

For all questions - sls@selectel.ru

Licensing

Serverless is licensed under the MIT License.

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

sels8s-1.0.3.tar.gz (3.4 kB view hashes)

Uploaded Source

Built Distribution

sels8s-1.0.3-py3-none-any.whl (4.0 kB view hashes)

Uploaded Python 3

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