本文整理汇总了Python中flask.ext.api.FlaskAPI.config['UPLOAD_FOLDER']方法的典型用法代码示例。如果您正苦于以下问题:Python FlaskAPI.config['UPLOAD_FOLDER']方法的具体用法?Python FlaskAPI.config['UPLOAD_FOLDER']怎么用?Python FlaskAPI.config['UPLOAD_FOLDER']使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类flask.ext.api.FlaskAPI
的用法示例。
在下文中一共展示了FlaskAPI.config['UPLOAD_FOLDER']方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: FlaskAPI
# 需要导入模块: from flask.ext.api import FlaskAPI [as 别名]
# 或者: from flask.ext.api.FlaskAPI import config['UPLOAD_FOLDER'] [as 别名]
from flask.ext.api import FlaskAPI
import os
from flask import request
from werkzeug import secure_filename
import subprocess
import json
import requests
app = FlaskAPI(__name__)
UPLOAD_FOLDER = '/home/miguel/'
app.config['UPLOAD_FOLDER'] = UPLOAD_FOLDER
@app.route('/send-image', methods=['POST', 'GET'])
def process_image():
print "Processing image!"
if request.method == 'POST':
file = request.files['file']
if file:
filename = secure_filename(file.filename)
file.save(os.path.join(app.config['UPLOAD_FOLDER'], filename))
print "imagen guardada con nombre {}".format(filename)
# imagen = open(filename, 'rb')
command = "alpr /home/miguel/{} -n 1 -j".format(filename)
process = subprocess.Popen(command.split(), stdout=subprocess.PIPE)
print "comando ejecutado"
output = json.loads(process.communicate()[0])
print "Despues del output"
true_plate = output['results'][0]['plate']
print true_plate
response = requests.get('http://greenheadapi.azurewebsites.net/api/place/getzone/{}'.format(true_plate))