summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCoprDistGit <infra@openeuler.org>2023-05-10 07:24:21 +0000
committerCoprDistGit <infra@openeuler.org>2023-05-10 07:24:21 +0000
commit4962e6f683a713790369e2bd99ae25e84040bd1e (patch)
treed3c6b4dca716135c0c6bf2f7fd978b76a642a565
parent580af1bcb9926c4c290a63bd0ec26f81fe6aadd1 (diff)
automatic import of python-wayscript
-rw-r--r--.gitignore1
-rw-r--r--python-wayscript.spec291
-rw-r--r--sources1
3 files changed, 293 insertions, 0 deletions
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 <Python_Bot@openeuler.org> - 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