diff options
author | CoprDistGit <infra@openeuler.org> | 2023-05-29 11:54:10 +0000 |
---|---|---|
committer | CoprDistGit <infra@openeuler.org> | 2023-05-29 11:54:10 +0000 |
commit | b1e55b42e8e0b1c38a9befe8307d68799bac6234 (patch) | |
tree | 8ce2d884739d9059b9e9f7f8a0333a07ebdd2db3 | |
parent | 02989db9184a32420ff18900e47a9bf6a50fa570 (diff) |
automatic import of python-pymacaron
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | python-pymacaron.spec | 339 | ||||
-rw-r--r-- | sources | 1 |
3 files changed, 341 insertions, 0 deletions
@@ -0,0 +1 @@ +/pymacaron-2.0.345.tar.gz diff --git a/python-pymacaron.spec b/python-pymacaron.spec new file mode 100644 index 0000000..5c8c172 --- /dev/null +++ b/python-pymacaron.spec @@ -0,0 +1,339 @@ +%global _empty_manifest_terminate_build 0 +Name: python-pymacaron +Version: 2.0.345 +Release: 1 +Summary: REST microservice framework based on Flask, OpenAPI, gunicorn and celery, deployable towards GKE and Beanstalk +License: BSD +URL: https://github.com/pymacaron/pymacaron +Source0: https://mirrors.nju.edu.cn/pypi/web/packages/18/13/dd652706c6bead1829fc075855591c8b6057e6260df5ff98b233aac392c6/pymacaron-2.0.345.tar.gz +BuildArch: noarch + + +%description + +# Pymacaron + +Python microservice framework based on Flask, OpenAPI and Celery, deployable +on GKE and Beanstalk + +PyMacaron's documentation is available at +[http://pymacaron.com/](http://pymacaron.com/). + +This page dives deeper into internal implementation details. + +## Deep dive + +### Built-in endpoints + +The following endpoints are built-in into every pymacaron instance, based +on [this swagger specification](https://github.com/pymacaron/pymacaron/blob/master/pymacaron/ping.yaml): + +``` +# Assuming you did in a separate terminal: +# $ python server.py --port 8080 + +$ curl http://127.0.0.1:8080/ping +{} + +$ curl http://127.0.0.1:8080/version +{ + "apis":["ping"], + "name": "helloworld", + "pym_env":"staging", + "version": "220120-2219-3820-a6f45b", +} + +$ curl http://127.0.0.1:8080/auth/version +{ + "error_description": "There is no Authorization header in the HTTP request", + "error_id": "17f900c8-b456-4a64-8b2b-83c7d36353f6", + "status": 401, + "error": "AUTHORIZATION_HEADER_MISSING" +} + +$ curl -H "Authorization: Bearer eyJpc3M[...]y8kNg" http://127.0.0.1:8080/auth/version +{ + "apis":["ping"], + "name": "helloworld", + "pym_env":"staging", + "version": "220120-2219-3820-a6f45b", +} + +``` + + +### Loading api clients from a standalone script + +It may come very handy within a standalone script to be able to call REST apis +through the pymacaron framework, to get object marshalling and error +handling out of the box. It is done as follows: + +```python +import flask +from pymacaron import apipool +from pymacaron.exceptions import is_error + +# Declare a Flask app and mock its context +app = flask.Flask(__name__) +with app.test_request_context(''): + + # Then load client libraries against a given set of libraries + api = API(app) + api.load_clients(apis=['login', 'search']) + + # And you can now call those apis seamlessly! + result = ApiPool.login.client.do_login( + ApiPool.login.model.LoginData( + name='foobar', + password='youdontwanttoknow' + ) + ) + + if is_error(result): + log.error("Oops. Failed to login user") +``` + +## Author + +Erwan Lemonnier<br/> +[github.com/pymacaron](https://github.com/pymacaron)</br> +[github.com/erwan-lemonnier](https://github.com/erwan-lemonnier)<br/> +[www.linkedin.com/in/erwan-lemonnier/](https://www.linkedin.com/in/erwan-lemonnier/) + + +%package -n python3-pymacaron +Summary: REST microservice framework based on Flask, OpenAPI, gunicorn and celery, deployable towards GKE and Beanstalk +Provides: python-pymacaron +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-pip +%description -n python3-pymacaron + +# Pymacaron + +Python microservice framework based on Flask, OpenAPI and Celery, deployable +on GKE and Beanstalk + +PyMacaron's documentation is available at +[http://pymacaron.com/](http://pymacaron.com/). + +This page dives deeper into internal implementation details. + +## Deep dive + +### Built-in endpoints + +The following endpoints are built-in into every pymacaron instance, based +on [this swagger specification](https://github.com/pymacaron/pymacaron/blob/master/pymacaron/ping.yaml): + +``` +# Assuming you did in a separate terminal: +# $ python server.py --port 8080 + +$ curl http://127.0.0.1:8080/ping +{} + +$ curl http://127.0.0.1:8080/version +{ + "apis":["ping"], + "name": "helloworld", + "pym_env":"staging", + "version": "220120-2219-3820-a6f45b", +} + +$ curl http://127.0.0.1:8080/auth/version +{ + "error_description": "There is no Authorization header in the HTTP request", + "error_id": "17f900c8-b456-4a64-8b2b-83c7d36353f6", + "status": 401, + "error": "AUTHORIZATION_HEADER_MISSING" +} + +$ curl -H "Authorization: Bearer eyJpc3M[...]y8kNg" http://127.0.0.1:8080/auth/version +{ + "apis":["ping"], + "name": "helloworld", + "pym_env":"staging", + "version": "220120-2219-3820-a6f45b", +} + +``` + + +### Loading api clients from a standalone script + +It may come very handy within a standalone script to be able to call REST apis +through the pymacaron framework, to get object marshalling and error +handling out of the box. It is done as follows: + +```python +import flask +from pymacaron import apipool +from pymacaron.exceptions import is_error + +# Declare a Flask app and mock its context +app = flask.Flask(__name__) +with app.test_request_context(''): + + # Then load client libraries against a given set of libraries + api = API(app) + api.load_clients(apis=['login', 'search']) + + # And you can now call those apis seamlessly! + result = ApiPool.login.client.do_login( + ApiPool.login.model.LoginData( + name='foobar', + password='youdontwanttoknow' + ) + ) + + if is_error(result): + log.error("Oops. Failed to login user") +``` + +## Author + +Erwan Lemonnier<br/> +[github.com/pymacaron](https://github.com/pymacaron)</br> +[github.com/erwan-lemonnier](https://github.com/erwan-lemonnier)<br/> +[www.linkedin.com/in/erwan-lemonnier/](https://www.linkedin.com/in/erwan-lemonnier/) + + +%package help +Summary: Development documents and examples for pymacaron +Provides: python3-pymacaron-doc +%description help + +# Pymacaron + +Python microservice framework based on Flask, OpenAPI and Celery, deployable +on GKE and Beanstalk + +PyMacaron's documentation is available at +[http://pymacaron.com/](http://pymacaron.com/). + +This page dives deeper into internal implementation details. + +## Deep dive + +### Built-in endpoints + +The following endpoints are built-in into every pymacaron instance, based +on [this swagger specification](https://github.com/pymacaron/pymacaron/blob/master/pymacaron/ping.yaml): + +``` +# Assuming you did in a separate terminal: +# $ python server.py --port 8080 + +$ curl http://127.0.0.1:8080/ping +{} + +$ curl http://127.0.0.1:8080/version +{ + "apis":["ping"], + "name": "helloworld", + "pym_env":"staging", + "version": "220120-2219-3820-a6f45b", +} + +$ curl http://127.0.0.1:8080/auth/version +{ + "error_description": "There is no Authorization header in the HTTP request", + "error_id": "17f900c8-b456-4a64-8b2b-83c7d36353f6", + "status": 401, + "error": "AUTHORIZATION_HEADER_MISSING" +} + +$ curl -H "Authorization: Bearer eyJpc3M[...]y8kNg" http://127.0.0.1:8080/auth/version +{ + "apis":["ping"], + "name": "helloworld", + "pym_env":"staging", + "version": "220120-2219-3820-a6f45b", +} + +``` + + +### Loading api clients from a standalone script + +It may come very handy within a standalone script to be able to call REST apis +through the pymacaron framework, to get object marshalling and error +handling out of the box. It is done as follows: + +```python +import flask +from pymacaron import apipool +from pymacaron.exceptions import is_error + +# Declare a Flask app and mock its context +app = flask.Flask(__name__) +with app.test_request_context(''): + + # Then load client libraries against a given set of libraries + api = API(app) + api.load_clients(apis=['login', 'search']) + + # And you can now call those apis seamlessly! + result = ApiPool.login.client.do_login( + ApiPool.login.model.LoginData( + name='foobar', + password='youdontwanttoknow' + ) + ) + + if is_error(result): + log.error("Oops. Failed to login user") +``` + +## Author + +Erwan Lemonnier<br/> +[github.com/pymacaron](https://github.com/pymacaron)</br> +[github.com/erwan-lemonnier](https://github.com/erwan-lemonnier)<br/> +[www.linkedin.com/in/erwan-lemonnier/](https://www.linkedin.com/in/erwan-lemonnier/) + + +%prep +%autosetup -n pymacaron-2.0.345 + +%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-pymacaron -f filelist.lst +%dir %{python3_sitelib}/* + +%files help -f doclist.lst +%{_docdir}/* + +%changelog +* Mon May 29 2023 Python_Bot <Python_Bot@openeuler.org> - 2.0.345-1 +- Package Spec generated @@ -0,0 +1 @@ +d3833c66c5fa7731cf97a10d6a82e9b1 pymacaron-2.0.345.tar.gz |