This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def __init__(self): | |
| # initialize the successor chain | |
| self.chain1 = Dispenser50() | |
| self.chain2 = Dispenser20() | |
| self.chain3 = Dispenser10() | |
| # set the chain of responsibility | |
| # The Client may compose chains once or | |
| # the hadler can set them dynamically at | |
| # handle time |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "openapi": "3.0.0", | |
| "info": { | |
| "version": "1.0.0", | |
| "title": "Seans-TypeScript-NodeJS-CRUD-REST-API-Boilerplate", | |
| "description": "A minimal and easy to follow example of what you need to create a CRUD style API in NodeJs using TypeScript", | |
| "license": { | |
| "name": "MIT", | |
| "url": "https://opensource.org/licenses/MIT" | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| APP = Flask(__name__) | |
| ### swagger specific ### | |
| SWAGGER_URL = '/swagger' | |
| API_URL = '/static/swagger.json' | |
| SWAGGERUI_BLUEPRINT = get_swaggerui_blueprint( | |
| SWAGGER_URL, | |
| API_URL, | |
| config={ | |
| 'app_name': "Seans-Python-Flask-REST-Boilerplate" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "openapi": "3.0.0", | |
| "info": { | |
| "description": "sean", | |
| "version": "1.0.0", | |
| "title": "Seans-Python3-Flask-Rest-Boilerplate", | |
| "contact": { | |
| "email": "[email protected]" | |
| }, | |
| "license": { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "openapi": "3.0.0", | |
| "info": { | |
| "description": "sean", | |
| "version": "1.0.0", | |
| "title": "Seans-Python3-Flask-Rest-Boilerplate", | |
| "contact": { | |
| "email": "[email protected]" | |
| }, | |
| "license": { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ... | |
| "license": { | |
| "name": "MIT", | |
| "url": "https://opensource.org/licenses/MIT" | |
| } | |
| }, | |
| "servers": [ | |
| { | |
| "url": "/" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ... | |
| "tags": [ | |
| { | |
| "name": "Book Request", | |
| "description": "Example API for requesting and return book requests" | |
| } | |
| ], | |
| "paths": { | |
| "/request": { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "openapi": "3.0.0", | |
| "info": { | |
| "description": "sean", | |
| "version": "1.0.0", | |
| "title": "Seans-Python3-Flask-Rest-Boilerplate", | |
| "contact": { | |
| "email": "[email protected]" | |
| }, | |
| "license": { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from flask import Flask, Response, stream_with_context | |
| import time | |
| import uuid | |
| import random | |
| APP = Flask(__name__) | |
| @APP.route("/very_large_request/<int:rowcount>", methods=["GET"]) | |
| def get_large_request(rowcount): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import requests | |
| import psycopg2 | |
| with requests.get("http://127.0.0.1:5000/very_large_request/100000000", stream=True) as r: | |
| conn = psycopg2.connect(dbname="stream_test", | |
| user="postgres", password="postgres") | |
| cur = conn.cursor() | |
| sql = "INSERT INTO transactions (txid, uid, amount) VALUES (%s, %s, %s)" |