Flask

Displaying opencv image using python flask

怎甘沉沦 提交于 2020-12-04 01:20:44
问题 I'm doing some processing on an image using opencv and using the python flask api. I'd like to display the image in the browser. import cv2 from flask import Flask, request, make_response import base64 import numpy as np import urllib app = Flask(__name__) @app.route('/endpoint', methods=['GET']) def process(): image_url = request.args.get('imageurl') requested_url = urllib.urlopen(image_url) image_array = np.asarray(bytearray(requested_url.read()), dtype=np.uint8) img = cv2.imdecode(image

Displaying opencv image using python flask

旧巷老猫 提交于 2020-12-04 01:16:41
问题 I'm doing some processing on an image using opencv and using the python flask api. I'd like to display the image in the browser. import cv2 from flask import Flask, request, make_response import base64 import numpy as np import urllib app = Flask(__name__) @app.route('/endpoint', methods=['GET']) def process(): image_url = request.args.get('imageurl') requested_url = urllib.urlopen(image_url) image_array = np.asarray(bytearray(requested_url.read()), dtype=np.uint8) img = cv2.imdecode(image

Displaying opencv image using python flask

狂风中的少年 提交于 2020-12-04 01:13:21
问题 I'm doing some processing on an image using opencv and using the python flask api. I'd like to display the image in the browser. import cv2 from flask import Flask, request, make_response import base64 import numpy as np import urllib app = Flask(__name__) @app.route('/endpoint', methods=['GET']) def process(): image_url = request.args.get('imageurl') requested_url = urllib.urlopen(image_url) image_array = np.asarray(bytearray(requested_url.read()), dtype=np.uint8) img = cv2.imdecode(image

Internal Redirect in Flask

女生的网名这么多〃 提交于 2020-12-03 07:34:50
问题 In short: By only using the Flask micro-framework (and its dependencies) can we perform an internal redirect from one route to another? For example: User submits the registration form (both username and password ) to @app.route('/register', methods=['POST']) If the registration is successful, Flask internally does an HTTP POST to @app.route('/login', methods['POST']) passing the username and password Process and log in the user Details: I am building a REST API using Flask and the Flask-JWT

Internal Redirect in Flask

荒凉一梦 提交于 2020-12-03 07:33:11
问题 In short: By only using the Flask micro-framework (and its dependencies) can we perform an internal redirect from one route to another? For example: User submits the registration form (both username and password ) to @app.route('/register', methods=['POST']) If the registration is successful, Flask internally does an HTTP POST to @app.route('/login', methods['POST']) passing the username and password Process and log in the user Details: I am building a REST API using Flask and the Flask-JWT

Store Excel file exported from Pandas in AWS

人盡茶涼 提交于 2020-12-03 06:49:03
问题 I'm making a small website using Flask, with a SQLite database. One of the things I want to do is take some data (from the database) and export it as an Excel file. I want to offer an option of downloading that Excel file. One option to do this is to use Pandas to write to an Excel file which would be stored on the web server, and to use Flask's send_file to offer the download option. However, is it possible to provide a downloadable Excel file without storing the file "locally" on the server

Store Excel file exported from Pandas in AWS

笑着哭i 提交于 2020-12-03 06:44:10
问题 I'm making a small website using Flask, with a SQLite database. One of the things I want to do is take some data (from the database) and export it as an Excel file. I want to offer an option of downloading that Excel file. One option to do this is to use Pandas to write to an Excel file which would be stored on the web server, and to use Flask's send_file to offer the download option. However, is it possible to provide a downloadable Excel file without storing the file "locally" on the server

Store Excel file exported from Pandas in AWS

别说谁变了你拦得住时间么 提交于 2020-12-03 06:43:20
问题 I'm making a small website using Flask, with a SQLite database. One of the things I want to do is take some data (from the database) and export it as an Excel file. I want to offer an option of downloading that Excel file. One option to do this is to use Pandas to write to an Excel file which would be stored on the web server, and to use Flask's send_file to offer the download option. However, is it possible to provide a downloadable Excel file without storing the file "locally" on the server

Access to Flask Global Variables in Blueprint Apps

安稳与你 提交于 2020-12-03 05:27:20
问题 my source code has this structure: main.py : from flask import Flask, g app = Flask(__name__) with app.app_context(): g.my_db = PostgreSQL() app.register_blueprint(my_app, url_prefix="/my_app") my_app.py : from flask import Blueprint, g my_app = Blueprint("my_app", __name__) @my_app.route("/") def index(): return g.my_db.fetch_all() <<< ERROR but it shows this error: AttributeError: '_AppCtxGlobals' object has no attribute 'my_db' Even when I try to use g outside of app context, it shows this

前端 js 校验机制绕过(burp、sqlmap 可用)

喜你入骨 提交于 2020-12-01 12:53:33
作者:L3B1anc 本文为作者投稿,Seebug Paper 期待你的分享,凡经采用即有礼品相送! 投稿邮箱:paper@seebug.org 最近做银行系统比较多,遇到了很多前端校验导致无法重放也不能上扫描器和sqlmap,最后想出来了个解决办法针对js的校验可以直接绕过 最近做测试的时候,一顿测完0 high 0 medium 0 low,想着上扫描器和sqlmap一顿梭哈的时候,发现请求包一重放就失效了,这样交报告那也不能够啊,只能想想怎么绕过这个防重放机制了。 1、发现验证机制 用burp对比了同样的两个请求,发现两个请求之间不同的只有H_TIME,H_NONCE,H_SN三个参数了,其中H_TIME一看就是时间戳。 按照经验来说,这种类似token的值,应该是每次请求页面都会去从服务器端生成一个新的token值,通过这个token值来进行防重放的。然而,发送请求后,发现返回的包里面的参数和提交请求的参数是一样的,那这样就只剩一种情况了,就是前端通过js生成校验码发送到服务器进行校验的。 F12大法搜搜两个关键字,发现还是某tong他老人家的安全机制,接着看看这个getUID的代码, getUID:function(){ var s = []; var hexDigits = "0123456789abcdef"; for (var i = 0; i < 36; i++)