From 3460405638241a43f3e171f07087d4890e6295d9 Mon Sep 17 00:00:00 2001 From: Philipp Lackinger <40075339+Phillackinger@users.noreply.github.com> Date: Mon, 25 Jan 2021 13:52:34 +0100 Subject: [PATCH 1/7] Create python-app.yml --- .github/workflows/python-app.yml | 36 ++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 .github/workflows/python-app.yml diff --git a/.github/workflows/python-app.yml b/.github/workflows/python-app.yml new file mode 100644 index 0000000..70bba55 --- /dev/null +++ b/.github/workflows/python-app.yml @@ -0,0 +1,36 @@ +# This workflow will install Python dependencies, run tests and lint with a single version of Python +# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions + +name: Python application + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: Set up Python 3.9 + uses: actions/setup-python@v2 + with: + python-version: 3.9 + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install flake8 pytest + if [ -f requirements.txt ]; then pip install -r requirements.txt; fi + - name: Lint with flake8 + run: | + # stop the build if there are Python syntax errors or undefined names + flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics + # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide + flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics + - name: Test with pytest + run: | + pytest From 5c4f4a8bd819ad84dd9f7cc203bb9c7d430028c3 Mon Sep 17 00:00:00 2001 From: Philipp Lackinger <40075339+Phillackinger@users.noreply.github.com> Date: Mon, 25 Jan 2021 13:58:51 +0100 Subject: [PATCH 2/7] Update python-app.yml --- .github/workflows/python-app.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/python-app.yml b/.github/workflows/python-app.yml index 70bba55..76b48f5 100644 --- a/.github/workflows/python-app.yml +++ b/.github/workflows/python-app.yml @@ -33,4 +33,5 @@ jobs: flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics - name: Test with pytest run: | - pytest + uvicorn main:app + pytest -v From a58824715b8e7c696abfe24ee1611668afac89ce Mon Sep 17 00:00:00 2001 From: Philipp Lackinger <40075339+Phillackinger@users.noreply.github.com> Date: Mon, 25 Jan 2021 14:10:15 +0100 Subject: [PATCH 3/7] Update database.py --- assets/database.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/assets/database.py b/assets/database.py index 45c7fd7..bc8018a 100644 --- a/assets/database.py +++ b/assets/database.py @@ -1,5 +1,13 @@ +import importlib import mysql.connector import env as e + +foung_env = importlib.util.find_spec("env") + +if env is not None: + import dummby_env as e + + # env (enviorment) is the env.py file where all of the # variables are stored for the database access create # your own file with all the needed variables (see below) From 7bdd9664769f44ccbddef8fe97b159b71ad8d8af Mon Sep 17 00:00:00 2001 From: Philipp Lackinger <40075339+Phillackinger@users.noreply.github.com> Date: Mon, 25 Jan 2021 14:16:46 +0100 Subject: [PATCH 4/7] =?UTF-8?q?=E2=9C=8F=EF=B8=8F=20Fixed=20Typo=20in=20da?= =?UTF-8?q?tabase.py?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assets/database.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets/database.py b/assets/database.py index bc8018a..65c4054 100644 --- a/assets/database.py +++ b/assets/database.py @@ -5,7 +5,7 @@ foung_env = importlib.util.find_spec("env") if env is not None: - import dummby_env as e + import dummy_env as e # env (enviorment) is the env.py file where all of the From 7d57999d51021fe11223aeff6ede91c3991b2e9a Mon Sep 17 00:00:00 2001 From: Philipp Lackinger <40075339+Phillackinger@users.noreply.github.com> Date: Mon, 25 Jan 2021 14:17:35 +0100 Subject: [PATCH 5/7] =?UTF-8?q?=E2=9C=8F=EF=B8=8F=20Fixed=20another=20typo?= =?UTF-8?q?=20I=20didn't=20saw=20last=20time...=20in=20database.py?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assets/database.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/assets/database.py b/assets/database.py index 65c4054..39dbb48 100644 --- a/assets/database.py +++ b/assets/database.py @@ -2,9 +2,9 @@ import mysql.connector import env as e -foung_env = importlib.util.find_spec("env") +found_env = importlib.util.find_spec("env") -if env is not None: +if found_env is not None: import dummy_env as e From 5a947e9a004c18badf2bcce2bbd90778697ad136 Mon Sep 17 00:00:00 2001 From: Philipp Lackinger <40075339+Phillackinger@users.noreply.github.com> Date: Mon, 25 Jan 2021 14:30:19 +0100 Subject: [PATCH 6/7] =?UTF-8?q?=F0=9F=94=A7=20created=20dummy=5Fenv.py?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dummy_env.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 dummy_env.py diff --git a/dummy_env.py b/dummy_env.py new file mode 100644 index 0000000..72e6e76 --- /dev/null +++ b/dummy_env.py @@ -0,0 +1,22 @@ +# DB + +db_host = "" +db_username = "" +db_password = "" +db_database = "" + +# GenericAPI Key + +key = "" + +# OAuth2 + +SECRET_KEY = "" + +# Mail + +mail_host = "" +mail_sender = "" +mail_username = "" +mail_password = "" +mail_port = 465 From 81feb9981bdb1ea7c6321e0fec01671783fb08e9 Mon Sep 17 00:00:00 2001 From: Philipp Lackinger <40075339+Phillackinger@users.noreply.github.com> Date: Mon, 25 Jan 2021 14:32:42 +0100 Subject: [PATCH 7/7] Update database.py --- assets/database.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/assets/database.py b/assets/database.py index 39dbb48..df018eb 100644 --- a/assets/database.py +++ b/assets/database.py @@ -1,7 +1,7 @@ import importlib import mysql.connector -import env as e - +try: + import env as e found_env = importlib.util.find_spec("env") if found_env is not None: