working app
This commit is contained in:
parent
dcf7d50e32
commit
ea25116d1c
2
.gitignore
vendored
2
.gitignore
vendored
@ -138,3 +138,5 @@ dmypy.json
|
||||
# Cython debug symbols
|
||||
cython_debug/
|
||||
|
||||
# Project-specific files
|
||||
cookies.txt
|
||||
|
@ -9,4 +9,4 @@ COPY app app
|
||||
|
||||
EXPOSE 5000
|
||||
|
||||
CMD ["flask", "run", "--host=0.0.0.0"]
|
||||
CMD ["flask", "run", "--debug", "--host=0.0.0.0"]
|
||||
|
@ -20,6 +20,9 @@ def process_request():
|
||||
|
||||
# Process image, text, and blocks as needed
|
||||
|
||||
# log to flask log the blocks list.
|
||||
app.logger.info(blocks)
|
||||
app.logger.info(text)
|
||||
return jsonify(success=True)
|
||||
|
||||
@app.route('/signup', methods=['GET', 'POST'])
|
||||
|
16
login_user.sh
Executable file
16
login_user.sh
Executable file
@ -0,0 +1,16 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [ "$#" -ne 2 ]; then
|
||||
echo "Usage: ./login_user.sh <username> <password>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
USERNAME="$1"
|
||||
PASSWORD="$2"
|
||||
|
||||
curl -X POST \
|
||||
-H "Content-Type: application/x-www-form-urlencoded" \
|
||||
-c cookies.txt \
|
||||
-d "username=${USERNAME}&password=${PASSWORD}" \
|
||||
http://localhost:5000/login
|
||||
|
16
signup_user.sh
Executable file
16
signup_user.sh
Executable file
@ -0,0 +1,16 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [ "$#" -ne 2 ]; then
|
||||
echo "Usage: ./signup_user.sh <username> <password>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
USERNAME="$1"
|
||||
PASSWORD="$2"
|
||||
|
||||
curl -X POST \
|
||||
-H "Content-Type: application/x-www-form-urlencoded" \
|
||||
-c cookies.txt \
|
||||
-d "username=${USERNAME}&password=${PASSWORD}" \
|
||||
http://localhost:5000/signup
|
||||
|
13
test_app.sh
Normal file → Executable file
13
test_app.sh
Normal file → Executable file
@ -1,14 +1,21 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [ "$#" -ne 1 ]; then
|
||||
echo "Usage: ./test_app.sh <image_path>"
|
||||
if [ "$#" -ne 3 ]; then
|
||||
echo "Usage: ./test_app.sh <username> <password> <image_path>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
IMAGE_PATH="$1"
|
||||
USERNAME="$1"
|
||||
PASSWORD="$2"
|
||||
IMAGE_PATH="$3"
|
||||
|
||||
# Signup and login the user to get the session cookie
|
||||
./signup_user.sh "${USERNAME}" "${PASSWORD}"
|
||||
./login_user.sh "${USERNAME}" "${PASSWORD}"
|
||||
|
||||
curl -X POST \
|
||||
-H "Content-Type: multipart/form-data" \
|
||||
-b cookies.txt \
|
||||
-F "image=@${IMAGE_PATH}" \
|
||||
-F "text=Sample Text" \
|
||||
-F "blocks=Block 1" \
|
||||
|
Loading…
Reference in New Issue
Block a user