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
    import time
    ex = True
    while ex:
        try:
            activation = serverless.invoke_function('my_function')
            ex = False
        except Exception:
            time.sleep(10)
    
    # get logs and results
    while ex:
        try:
            logs = serverless.get_activation_logs(activation.json()['activation_id'])
            result = serverless.get_activation_result(activation.json()['activation_id'])
            ex = False
        except Exception:
            time.sleep(10)
    

Examples

You can see examples of using cloud functions here

Features

Cloud functions

Docs

Community

GitHub

For all questions - Our Telegram

Licensing

Serverless is licensed under the Apache 2.0.

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.7.tar.gz (4.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sels8s-1.0.7-py3-none-any.whl (4.2 kB view details)

Uploaded Python 3

File details

Details for the file sels8s-1.0.7.tar.gz.

File metadata

  • Download URL: sels8s-1.0.7.tar.gz
  • Upload date:
  • Size: 4.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.9.5

File hashes

Hashes for sels8s-1.0.7.tar.gz
Algorithm Hash digest
SHA256 28adeb3156efbe1a5d181a91db730cee46e471011b4df464b25577e36080ba39
MD5 16da97aa07b95aaf5cd8ebf87109988e
BLAKE2b-256 dc65f111a6fa07f6532e85aab54e6551e9f28dba6a1c4d383548d74ec0ee1ccd

See more details on using hashes here.

File details

Details for the file sels8s-1.0.7-py3-none-any.whl.

File metadata

  • Download URL: sels8s-1.0.7-py3-none-any.whl
  • Upload date:
  • Size: 4.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.9.5

File hashes

Hashes for sels8s-1.0.7-py3-none-any.whl
Algorithm Hash digest
SHA256 567c8f3e5c9eded0d06b4f341d9274eee76dcbd802465d428ddff7fad255468f
MD5 7625df507ab389ed77f08f06d67e313c
BLAKE2b-256 e4f593120c3c8f56adda077d3ccb05e325e6ede9b3a2062dd9d92c549ce6dcb4

See more details on using hashes here.

Supported by

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