%global _empty_manifest_terminate_build 0 Name: python-dead-simple-framework Version: 1.3.9 Release: 1 Summary: RESTful Flask framework with builtin MongoDB, Redis, Celery, Sentry and Slack integrations License: MIT URL: https://github.com/Topazoo/dead_simple_framework Source0: https://mirrors.nju.edu.cn/pypi/web/packages/09/de/eb09a4e2c2e4e56ef44bd4c058b73c8bc53c43e9cdd5dbe4180dc02e295a/dead_simple_framework-1.3.9.tar.gz BuildArch: noarch Requires: python3-flask Requires: python3-pymongo Requires: python3-celery Requires: python3-flask-cors Requires: python3-requests Requires: python3-redis Requires: python3-eventlet Requires: python3-pyOpenSSL Requires: python3-Flask-JWT-Extended Requires: python3-passlib Requires: python3-jsonschema Requires: python3-sentry-sdk[flask] Requires: python3-slack-sdk Requires: python3-Flask-PyMongo %description # 🙈 Dead Simple Web Framework 🙉 [![Python](https://img.shields.io/badge/Python-3.5.7+-blue.svg)](https://www.python.org/downloads/) [![Flask](https://img.shields.io/badge/Flask-1.1.1-yellow.svg)](https://flask.palletsprojects.com/en/1.1.x/) [![MongoDB/Pymongo](https://img.shields.io/badge/MongoDB-4.2-green.svg)](https://docs.mongodb.com/drivers/pymongo) [![PyPi](https://img.shields.io/badge/View%20On-PyPi-orange.svg)](https://pypi.org/project/dead-simple-framework/) ## Overview: A RESTful Flask framework with MongoDB, Redis, Celery, Slack and Sentry integrations: Backend: - Flask [Framework] - MongoDB [Database] - Redis [Cache] - Celery + RabbitMQ [Async Tasks] - Slack + Sentry [Logging] ## Installing: ```sh $ pip install dead-simple-framework ``` ## Configuration: TODO - DOCS ## Example Application (`demo.py`): ```python from dead_simple_framework import Route, RouteHandler, Application from dead_simple_framework.handlers import UserRouteHandler, LoginRouteHandler, Permissions, DefaultPermissionsRouteHandler from dead_simple_framework.database import Indices from dead_simple_framework.api.errors import API_Error from dead_simple_framework.api.utils import JsonError # Method that throws a sample error def throw(msg): raise API_Error(msg, 400) # App config for a simple blog application with user accounts sample_config = { 'routes': { # Users 'users': Route( # Route with a built-in handler for creating, updating, fetching and deleting users # Only authenticated users can perform certain operations. # Adding a `verifier` to the class will let you allow only a specific user to update # their data or delete their account. url = '/api/users', handler=UserRouteHandler(permissions=Permissions( PUT='USER', PATCH='USER', GET='USER', DELETE='USER' )), # The schema controls what data can be passed to the endpoint # In this case, a user ObjectId is required and the only property # supported. schema={ 'GET': { 'type': 'object', 'properties': { '_id': {'type': 'string'} }, 'required': ['_id'] } }, # The MongoDB collection where data for this route should be stored # It is passed to any overloaded method handlers (e.g. a custom GET method) collection='users' ), # Authentication 'authentication': Route( # Route with a built-in handler for authenticating users and issuing a JSON Web Token url='/api/authenticate', handler=LoginRouteHandler(), # It relies on the same collection as the core `users` route collection='users' ), # Posts 'posts': Route( # Route with a builtin generic CRUD handler for creating, updating, fetching and deleting posts # Only authenticated users can perform certain operations. url='/api/posts', handler=DefaultPermissionsRouteHandler(permissions=Permissions(POST=['USER'], PUT=['USER'], PATCH=['USER'], DELETE=['USER'])), collection='posts' ), # Sample Error 'error': Route( # Route that demonstrates built-in error handling url='/error', handler=RouteHandler( # Custom handlers allow a POST request or a GET request to create different errors POST=lambda request, payload: throw(f'POST - Error from payload {payload}'), GET=lambda request, payload: JsonError('This is a GET error', code=500), ) ), }, # Application settings 'settings': { # JWT Settings determine if the app uses JWT, what the token lifespan will be and more 'jwt_settings': { 'app_use_jwt': True, 'app_jwt_lifespan': 600, 'app_permissions': ['USER', 'ADMIN'], } }, # MongoDB indices for each collection used by the application 'indices': Indices({ 'users': { 'username': { 'order': -1 }, 'password': { 'order': 1, 'compound_with': 'username' } }, }) } if __name__ == '__main__': Application(sample_config).run() ``` - Starts a local server at http://0.0.0.0:5000/ - Serves CRUD operations for MongoDB users collection `users` at endpoint `/api/users` - Issues JWT tokents for created users at endpoint `/api/authenticate` - Serves CRUD operations for MongoDB collection `posts` at endpoint `/api/posts` - Demos errors at endpoint `/error` %package -n python3-dead-simple-framework Summary: RESTful Flask framework with builtin MongoDB, Redis, Celery, Sentry and Slack integrations Provides: python-dead-simple-framework BuildRequires: python3-devel BuildRequires: python3-setuptools BuildRequires: python3-pip %description -n python3-dead-simple-framework # 🙈 Dead Simple Web Framework 🙉 [![Python](https://img.shields.io/badge/Python-3.5.7+-blue.svg)](https://www.python.org/downloads/) [![Flask](https://img.shields.io/badge/Flask-1.1.1-yellow.svg)](https://flask.palletsprojects.com/en/1.1.x/) [![MongoDB/Pymongo](https://img.shields.io/badge/MongoDB-4.2-green.svg)](https://docs.mongodb.com/drivers/pymongo) [![PyPi](https://img.shields.io/badge/View%20On-PyPi-orange.svg)](https://pypi.org/project/dead-simple-framework/) ## Overview: A RESTful Flask framework with MongoDB, Redis, Celery, Slack and Sentry integrations: Backend: - Flask [Framework] - MongoDB [Database] - Redis [Cache] - Celery + RabbitMQ [Async Tasks] - Slack + Sentry [Logging] ## Installing: ```sh $ pip install dead-simple-framework ``` ## Configuration: TODO - DOCS ## Example Application (`demo.py`): ```python from dead_simple_framework import Route, RouteHandler, Application from dead_simple_framework.handlers import UserRouteHandler, LoginRouteHandler, Permissions, DefaultPermissionsRouteHandler from dead_simple_framework.database import Indices from dead_simple_framework.api.errors import API_Error from dead_simple_framework.api.utils import JsonError # Method that throws a sample error def throw(msg): raise API_Error(msg, 400) # App config for a simple blog application with user accounts sample_config = { 'routes': { # Users 'users': Route( # Route with a built-in handler for creating, updating, fetching and deleting users # Only authenticated users can perform certain operations. # Adding a `verifier` to the class will let you allow only a specific user to update # their data or delete their account. url = '/api/users', handler=UserRouteHandler(permissions=Permissions( PUT='USER', PATCH='USER', GET='USER', DELETE='USER' )), # The schema controls what data can be passed to the endpoint # In this case, a user ObjectId is required and the only property # supported. schema={ 'GET': { 'type': 'object', 'properties': { '_id': {'type': 'string'} }, 'required': ['_id'] } }, # The MongoDB collection where data for this route should be stored # It is passed to any overloaded method handlers (e.g. a custom GET method) collection='users' ), # Authentication 'authentication': Route( # Route with a built-in handler for authenticating users and issuing a JSON Web Token url='/api/authenticate', handler=LoginRouteHandler(), # It relies on the same collection as the core `users` route collection='users' ), # Posts 'posts': Route( # Route with a builtin generic CRUD handler for creating, updating, fetching and deleting posts # Only authenticated users can perform certain operations. url='/api/posts', handler=DefaultPermissionsRouteHandler(permissions=Permissions(POST=['USER'], PUT=['USER'], PATCH=['USER'], DELETE=['USER'])), collection='posts' ), # Sample Error 'error': Route( # Route that demonstrates built-in error handling url='/error', handler=RouteHandler( # Custom handlers allow a POST request or a GET request to create different errors POST=lambda request, payload: throw(f'POST - Error from payload {payload}'), GET=lambda request, payload: JsonError('This is a GET error', code=500), ) ), }, # Application settings 'settings': { # JWT Settings determine if the app uses JWT, what the token lifespan will be and more 'jwt_settings': { 'app_use_jwt': True, 'app_jwt_lifespan': 600, 'app_permissions': ['USER', 'ADMIN'], } }, # MongoDB indices for each collection used by the application 'indices': Indices({ 'users': { 'username': { 'order': -1 }, 'password': { 'order': 1, 'compound_with': 'username' } }, }) } if __name__ == '__main__': Application(sample_config).run() ``` - Starts a local server at http://0.0.0.0:5000/ - Serves CRUD operations for MongoDB users collection `users` at endpoint `/api/users` - Issues JWT tokents for created users at endpoint `/api/authenticate` - Serves CRUD operations for MongoDB collection `posts` at endpoint `/api/posts` - Demos errors at endpoint `/error` %package help Summary: Development documents and examples for dead-simple-framework Provides: python3-dead-simple-framework-doc %description help # 🙈 Dead Simple Web Framework 🙉 [![Python](https://img.shields.io/badge/Python-3.5.7+-blue.svg)](https://www.python.org/downloads/) [![Flask](https://img.shields.io/badge/Flask-1.1.1-yellow.svg)](https://flask.palletsprojects.com/en/1.1.x/) [![MongoDB/Pymongo](https://img.shields.io/badge/MongoDB-4.2-green.svg)](https://docs.mongodb.com/drivers/pymongo) [![PyPi](https://img.shields.io/badge/View%20On-PyPi-orange.svg)](https://pypi.org/project/dead-simple-framework/) ## Overview: A RESTful Flask framework with MongoDB, Redis, Celery, Slack and Sentry integrations: Backend: - Flask [Framework] - MongoDB [Database] - Redis [Cache] - Celery + RabbitMQ [Async Tasks] - Slack + Sentry [Logging] ## Installing: ```sh $ pip install dead-simple-framework ``` ## Configuration: TODO - DOCS ## Example Application (`demo.py`): ```python from dead_simple_framework import Route, RouteHandler, Application from dead_simple_framework.handlers import UserRouteHandler, LoginRouteHandler, Permissions, DefaultPermissionsRouteHandler from dead_simple_framework.database import Indices from dead_simple_framework.api.errors import API_Error from dead_simple_framework.api.utils import JsonError # Method that throws a sample error def throw(msg): raise API_Error(msg, 400) # App config for a simple blog application with user accounts sample_config = { 'routes': { # Users 'users': Route( # Route with a built-in handler for creating, updating, fetching and deleting users # Only authenticated users can perform certain operations. # Adding a `verifier` to the class will let you allow only a specific user to update # their data or delete their account. url = '/api/users', handler=UserRouteHandler(permissions=Permissions( PUT='USER', PATCH='USER', GET='USER', DELETE='USER' )), # The schema controls what data can be passed to the endpoint # In this case, a user ObjectId is required and the only property # supported. schema={ 'GET': { 'type': 'object', 'properties': { '_id': {'type': 'string'} }, 'required': ['_id'] } }, # The MongoDB collection where data for this route should be stored # It is passed to any overloaded method handlers (e.g. a custom GET method) collection='users' ), # Authentication 'authentication': Route( # Route with a built-in handler for authenticating users and issuing a JSON Web Token url='/api/authenticate', handler=LoginRouteHandler(), # It relies on the same collection as the core `users` route collection='users' ), # Posts 'posts': Route( # Route with a builtin generic CRUD handler for creating, updating, fetching and deleting posts # Only authenticated users can perform certain operations. url='/api/posts', handler=DefaultPermissionsRouteHandler(permissions=Permissions(POST=['USER'], PUT=['USER'], PATCH=['USER'], DELETE=['USER'])), collection='posts' ), # Sample Error 'error': Route( # Route that demonstrates built-in error handling url='/error', handler=RouteHandler( # Custom handlers allow a POST request or a GET request to create different errors POST=lambda request, payload: throw(f'POST - Error from payload {payload}'), GET=lambda request, payload: JsonError('This is a GET error', code=500), ) ), }, # Application settings 'settings': { # JWT Settings determine if the app uses JWT, what the token lifespan will be and more 'jwt_settings': { 'app_use_jwt': True, 'app_jwt_lifespan': 600, 'app_permissions': ['USER', 'ADMIN'], } }, # MongoDB indices for each collection used by the application 'indices': Indices({ 'users': { 'username': { 'order': -1 }, 'password': { 'order': 1, 'compound_with': 'username' } }, }) } if __name__ == '__main__': Application(sample_config).run() ``` - Starts a local server at http://0.0.0.0:5000/ - Serves CRUD operations for MongoDB users collection `users` at endpoint `/api/users` - Issues JWT tokents for created users at endpoint `/api/authenticate` - Serves CRUD operations for MongoDB collection `posts` at endpoint `/api/posts` - Demos errors at endpoint `/error` %prep %autosetup -n dead-simple-framework-1.3.9 %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-dead-simple-framework -f filelist.lst %dir %{python3_sitelib}/* %files help -f doclist.lst %{_docdir}/* %changelog * Fri May 05 2023 Python_Bot - 1.3.9-1 - Package Spec generated