add args flask example and update example env
This commit is contained in:
@ -8,7 +8,7 @@ RUN target=/root/.cache/pip \
|
||||
|
||||
COPY . .
|
||||
|
||||
ENV FLASK_APP app.py
|
||||
ENV FLASK_APP giapp.py
|
||||
|
||||
# This might be scary to leave on
|
||||
#ENV FLASK_ENV development
|
||||
|
@ -1,6 +1,6 @@
|
||||
import os
|
||||
from datetime import datetime
|
||||
from flask import Flask
|
||||
from flask import Flask, request
|
||||
import mysql.connector
|
||||
|
||||
|
||||
@ -46,6 +46,10 @@ def listBlog():
|
||||
rec = conn.query_titles()
|
||||
|
||||
response = ''
|
||||
ict = ''
|
||||
arg1 = ''
|
||||
arg2 = ''
|
||||
|
||||
for c in rec:
|
||||
response = response + '<div> Log: ' + c + '</div>'
|
||||
|
||||
@ -54,6 +58,28 @@ def listBlog():
|
||||
response = response + '<div>Delta: ' + dtFormatted + '</div>'
|
||||
return response
|
||||
|
||||
@server.route('/args-test', methods=['GET'])
|
||||
def listArgs():
|
||||
|
||||
good_token_i = str(os.getenv("TOKEN_I"))
|
||||
ict = str(request.args.get('ict'))
|
||||
arg1 = str(request.args.get('arg1'))
|
||||
arg2 = str(request.args.get('arg2'))
|
||||
|
||||
response = ''
|
||||
|
||||
#INSECURE DEBUG response = response + '<div> gt:' + good_token_i + 'it:' + ict + '</div>'
|
||||
|
||||
if request.args.get('ict') == good_token_i:
|
||||
response = response + '<div>Success</div>'
|
||||
response = response + '<div>arg1' + arg1 + '</div>'
|
||||
response = response + '<div>arg2' + arg2 + '</div>'
|
||||
|
||||
dt = datetime.now()
|
||||
dtFormatted = dt.strftime("%Y-%m-%d %H:%M")
|
||||
response = response + '<div>Delta: ' + dtFormatted + '</div>'
|
||||
return response
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
server.run()
|
||||
|
Reference in New Issue
Block a user