SDK for python serverless functions
Project description
Serverless cloud functions
Contents
Quick Start
- Install via pip:
pip install sels8s
- Download rc.sh file from Selectel panel
- 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
- 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
Community
For all questions - Our Telegram
Licensing
Serverless is licensed under the Apache 2.0.
Project details
Release history Release notifications | RSS feed
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 hashes)
Built Distribution
sels8s-1.0.7-py3-none-any.whl
(4.2 kB
view hashes)