From 0540b280581f95e2e8510e6e945d304294b83fbb Mon Sep 17 00:00:00 2001 From: nnayk <79224511+nnayk@users.noreply.github.com> Date: Sat, 11 Nov 2023 17:28:00 -0800 Subject: [PATCH] Remove secrets again from dependencies (it was causing the pipeline issue). Fix pycodestyle violations --- Backend/backend.py | 3 ++- Backend/db_access.py | 1 + Backend/generate_url.py | 3 ++- Backend/requirements.txt | 3 +-- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/Backend/backend.py b/Backend/backend.py index 749d776..c8a93aa 100644 --- a/Backend/backend.py +++ b/Backend/backend.py @@ -18,6 +18,7 @@ "http://127.0.0.1:5001" # This is where db_access.py is running. ) + @app.route("/submit", methods=["POST"]) def submit(): data = request.get_json() @@ -80,4 +81,4 @@ def create_user(): try: app.run(port=5000, debug=True) except OSError as e: - print(f"Error: {e}. Is port 5000 already in use?") \ No newline at end of file + print(f"Error: {e}. Is port 5000 already in use?") diff --git a/Backend/db_access.py b/Backend/db_access.py index 2853bbd..baf5d25 100644 --- a/Backend/db_access.py +++ b/Backend/db_access.py @@ -18,6 +18,7 @@ # MongoDB connection connect(db="dbPicturePerfect", host="localhost", port=27017) + class User(Document): username = StringField(required=True, unique=True) name = StringField(required=True) diff --git a/Backend/generate_url.py b/Backend/generate_url.py index 911a563..50fb18a 100644 --- a/Backend/generate_url.py +++ b/Backend/generate_url.py @@ -1,6 +1,7 @@ import requests import sys + def generate_url(prompt): url = "https://imagegolf.io/api/generate" data = { @@ -11,11 +12,11 @@ def generate_url(prompt): return (r.json()["output"]) + if __name__ == "__main__": if len(sys.argv) < 2: print("Usage: script_name ") sys.exit(1) - input_value = sys.argv[1] result = generate_url(input_value) print(result) diff --git a/Backend/requirements.txt b/Backend/requirements.txt index 57eb0f3..d813ef0 100644 --- a/Backend/requirements.txt +++ b/Backend/requirements.txt @@ -2,5 +2,4 @@ pycodestyle flask flask_cors mongoengine -werkzeug -secrets \ No newline at end of file +werkzeug \ No newline at end of file