!C99Shell v. 2.0 [PHP 7 Update] [25.02.2019]!

Software: Apache/2.4.18 (Ubuntu). PHP/7.0.33-0ubuntu0.16.04.16 

uname -a: Linux digifus 3.13.0-57-generic #95-Ubuntu SMP Fri Jun 19 09:28:15 UTC 2015 x86_64 

uid=33(www-data) gid=33(www-data) groups=33(www-data) 

Safe-mode: OFF (not secure)

/var/tmp/junk/FlaskApp/FlaskApp/   drwxrwxr-x
Free 9.94 GB of 29.4 GB (33.82%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Feedback    Self remove    Logout    


Viewing file:     __init__.py (2.58 KB)      -rwxrwxr-x
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
from flask import Flask
from flask.ext.api import status

from json import dumps
from flask import request
from flask import Response
import database_functions

app = Flask(__name__)

#Create an instance of SQLAclhemy
#from flask.ext.sqlalchemy import SQLAlchemy
#db = SQLAlchemy(app)

flask_debug = True

    
# API REST
@app.route('/product', methods=['GET'])
def get_product_list():
    # return foreach product {id, name, description, price, qr}
    return dumps(database_functions.get_all_products())


@app.route('/product', methods=['POST'])
def add_product():
    # data: ex. { 'id' : null, 'name': 'product', 'description': 'a product named product', 'price': 0.5}
    name = request.form['name']
    description = request.form['description']
    price = float(request.form['price'])

    qr_code = database_functions.create_qr_for_new_product(name)

    database_functions.insert_product(name, description, price)

    return Response("Producto creado", status=200, mimetype='application/json')

@app.route('/product/<string:product_id>', methods=['PUT'])
def update_product(product_id):
    pass 

@app.route('/product/<string:product_id>', methods=['GET'])
def get_product_detail(product_id):
    return dumps(database_functions.get_product_by_name(product_id))

@app.route('/product/<string:product_id>/qr', methods=['GET'])
def get_qrcode(product_id):
    from flask import send_file
        filename = database_functions.get_qr_filename_from_product(product_id)
        # TODO: Verify filename is not None
    return send_file(filename, mimetype='image/png')

@app.route('/order', methods=['POST'])
def create_order():
        ''' {
            "id": null,
            "seller_id": "seller 1",
            "client": "client_id",
            "iva": 21.0,
            "discount": 0.10
            "products": [
                {
                    "name": "product1",
                    "count": 5
                },
                ...
             ]
            }
        '''
        seller_id = request.form['seller_id']
        client_id = request.form['client_id']
        iva = request.form['iva']
        discount = request.form['discount']
        products = request.form['products'] 
        print seller_id, client_id, iva, discount, products
    database_functions.insert_order(seller_id, client_id, iva, discount, products)
    return Response("Orden creada", status=200, mimetype='application/json')

@app.route('/client', methods=['GET'])
def get_all_clients():
    # return foreach client {id, name, business_name , address, cuit, city, iva, mail }
    return dumps(database_functions.get_all_clients())


if __name__ == '__main__':
    app.run(port=8080)

:: Command execute ::

Enter:
 
Select:
 

:: Search ::
  - regexp 

:: Upload ::
 
[ Read-Only ]

:: Make Dir ::
 
[ Read-Only ]
:: Make File ::
 
[ Read-Only ]

:: Go Dir ::
 
:: Go File ::
 

--[ c99shell v. 2.0 [PHP 7 Update] [25.02.2019] maintained by KaizenLouie | C99Shell Github | Generation time: 0.0052 ]--