From 4962e6f683a713790369e2bd99ae25e84040bd1e Mon Sep 17 00:00:00 2001 From: CoprDistGit Date: Wed, 10 May 2023 07:24:21 +0000 Subject: automatic import of python-wayscript --- .gitignore | 1 + python-wayscript.spec | 291 ++++++++++++++++++++++++++++++++++++++++++++++++++ sources | 1 + 3 files changed, 293 insertions(+) create mode 100644 python-wayscript.spec create mode 100644 sources diff --git a/.gitignore b/.gitignore index e69de29..a9324f0 100644 --- a/.gitignore +++ b/.gitignore @@ -0,0 +1 @@ +/wayscript-0.4.0.tar.gz diff --git a/python-wayscript.spec b/python-wayscript.spec new file mode 100644 index 0000000..4d798d5 --- /dev/null +++ b/python-wayscript.spec @@ -0,0 +1,291 @@ +%global _empty_manifest_terminate_build 0 +Name: python-wayscript +Version: 0.4.0 +Release: 1 +Summary: Quickly build services, data pipelines, internal tools, and more. +License: MIT +URL: https://github.com/wayscript/wayscript-python +Source0: https://mirrors.nju.edu.cn/pypi/web/packages/89/e6/a5f45a9433aaf346e0eb13098ed0a84d528ddaecb24c5f9e98abb188b367/wayscript-0.4.0.tar.gz +BuildArch: noarch + + +%description +# wayscript-python + +## Context + +``` +from wayscript import context + +event = context.get_event() +``` + +### Checking user by application key +``` +from wayscript import context, utils + +application_key = utils.get_application_key() +user = context.get_user_by_application_key(application_key) +``` +## Triggers + +### HTTP Triggers + +``` +from wayscript.triggers import http_trigger + +payload = {"hello": "world"} +headers = {"content-type": "application/json"} +status_code = 200 + +http_trigger.send_response(data=payload, headers=headers, status_code=status_code) +``` + +## Integrations + +### SQL + +To connect to a postgres resource, use the following snippet: +``` +import psycopg2 +from wayscript.integrations import sql + +kwargs = sql.get_psycopg2_connection_kwargs(_id) +connection = psycopg2.connect(**kwargs) +``` + +## Secrets + +### Create/Update Secret + +To create a new secret, or update an existing one: +``` +from wayscript import secret_manager + +my_secret_value = "an application key or other private information" +secret_manager.set_secret('my_secret_key', my_secret_value) + +``` + +To test an existing secret, and update if the secret is no longer valid (expired authorization token): +``` +import os +from wayscript import secret_manager + +# Retrieve existing key from secret +auth_key = os.getenv('AUTH_KEY_MAY_EXPIRE') + +# Test connection to service using auth_key +if not authorized: + # Get new auth_key from service + auth_key = 'New Key From Service Request' + secret_manager.set_secret('AUTH_KEY_MAY_EXPIRE', auth_key) + +# Continue flow as normal +``` + + +%package -n python3-wayscript +Summary: Quickly build services, data pipelines, internal tools, and more. +Provides: python-wayscript +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-pip +%description -n python3-wayscript +# wayscript-python + +## Context + +``` +from wayscript import context + +event = context.get_event() +``` + +### Checking user by application key +``` +from wayscript import context, utils + +application_key = utils.get_application_key() +user = context.get_user_by_application_key(application_key) +``` +## Triggers + +### HTTP Triggers + +``` +from wayscript.triggers import http_trigger + +payload = {"hello": "world"} +headers = {"content-type": "application/json"} +status_code = 200 + +http_trigger.send_response(data=payload, headers=headers, status_code=status_code) +``` + +## Integrations + +### SQL + +To connect to a postgres resource, use the following snippet: +``` +import psycopg2 +from wayscript.integrations import sql + +kwargs = sql.get_psycopg2_connection_kwargs(_id) +connection = psycopg2.connect(**kwargs) +``` + +## Secrets + +### Create/Update Secret + +To create a new secret, or update an existing one: +``` +from wayscript import secret_manager + +my_secret_value = "an application key or other private information" +secret_manager.set_secret('my_secret_key', my_secret_value) + +``` + +To test an existing secret, and update if the secret is no longer valid (expired authorization token): +``` +import os +from wayscript import secret_manager + +# Retrieve existing key from secret +auth_key = os.getenv('AUTH_KEY_MAY_EXPIRE') + +# Test connection to service using auth_key +if not authorized: + # Get new auth_key from service + auth_key = 'New Key From Service Request' + secret_manager.set_secret('AUTH_KEY_MAY_EXPIRE', auth_key) + +# Continue flow as normal +``` + + +%package help +Summary: Development documents and examples for wayscript +Provides: python3-wayscript-doc +%description help +# wayscript-python + +## Context + +``` +from wayscript import context + +event = context.get_event() +``` + +### Checking user by application key +``` +from wayscript import context, utils + +application_key = utils.get_application_key() +user = context.get_user_by_application_key(application_key) +``` +## Triggers + +### HTTP Triggers + +``` +from wayscript.triggers import http_trigger + +payload = {"hello": "world"} +headers = {"content-type": "application/json"} +status_code = 200 + +http_trigger.send_response(data=payload, headers=headers, status_code=status_code) +``` + +## Integrations + +### SQL + +To connect to a postgres resource, use the following snippet: +``` +import psycopg2 +from wayscript.integrations import sql + +kwargs = sql.get_psycopg2_connection_kwargs(_id) +connection = psycopg2.connect(**kwargs) +``` + +## Secrets + +### Create/Update Secret + +To create a new secret, or update an existing one: +``` +from wayscript import secret_manager + +my_secret_value = "an application key or other private information" +secret_manager.set_secret('my_secret_key', my_secret_value) + +``` + +To test an existing secret, and update if the secret is no longer valid (expired authorization token): +``` +import os +from wayscript import secret_manager + +# Retrieve existing key from secret +auth_key = os.getenv('AUTH_KEY_MAY_EXPIRE') + +# Test connection to service using auth_key +if not authorized: + # Get new auth_key from service + auth_key = 'New Key From Service Request' + secret_manager.set_secret('AUTH_KEY_MAY_EXPIRE', auth_key) + +# Continue flow as normal +``` + + +%prep +%autosetup -n wayscript-0.4.0 + +%build +%py3_build + +%install +%py3_install +install -d -m755 %{buildroot}/%{_pkgdocdir} +if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi +if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi +if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi +if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi +pushd %{buildroot} +if [ -d usr/lib ]; then + find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/lib64 ]; then + find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/bin ]; then + find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/sbin ]; then + find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst +fi +touch doclist.lst +if [ -d usr/share/man ]; then + find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst +fi +popd +mv %{buildroot}/filelist.lst . +mv %{buildroot}/doclist.lst . + +%files -n python3-wayscript -f filelist.lst +%dir %{python3_sitelib}/* + +%files help -f doclist.lst +%{_docdir}/* + +%changelog +* Wed May 10 2023 Python_Bot - 0.4.0-1 +- Package Spec generated diff --git a/sources b/sources new file mode 100644 index 0000000..6ba5c5c --- /dev/null +++ b/sources @@ -0,0 +1 @@ +d2a4346c819971a4ce22607d7300504a wayscript-0.4.0.tar.gz -- cgit v1.2.3