From 04e8bb9935134d5068e923b072b70d8041c92142 Mon Sep 17 00:00:00 2001 From: abhigyanghosh30 Date: Fri, 29 Mar 2024 03:13:08 +0530 Subject: [PATCH] format and lint python --- webapp/shop/cred/views.py | 25 +++++++++++++------------ webapp/views.py | 2 -- 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/webapp/shop/cred/views.py b/webapp/shop/cred/views.py index c214dd0ddf4..0360298e8a3 100644 --- a/webapp/shop/cred/views.py +++ b/webapp/shop/cred/views.py @@ -111,7 +111,7 @@ def cred_sign_up(**_): return flask.render_template( "credentials/sign-up.html", sign_up_open=sign_up_open ) - + form_fields = {} for key in flask.request.form: values = flask.request.form.getlist(key) @@ -174,20 +174,20 @@ def cred_sign_up(**_): ) return ( - flask.render_template("credentials/sign-up.html", error="Something went wrong"), + flask.render_template( + "credentials/sign-up.html", error="Something went wrong" + ), 400, ) service_account_info = { - "token_uri": "https://oauth2.googleapis.com/token", - "client_email": os.getenv("GOOGLE_SERVICE_ACCOUNT_EMAIL"), - "private_key": os.getenv( - "GOOGLE_SERVICE_ACCOUNT_PRIVATE_KEY" - ).replace("\\n", "\n"), - "scopes": [ - "https://www.googleapis.com/auth/spreadsheets.readonly" - ], - } + "token_uri": "https://oauth2.googleapis.com/token", + "client_email": os.getenv("GOOGLE_SERVICE_ACCOUNT_EMAIL"), + "private_key": os.getenv("GOOGLE_SERVICE_ACCOUNT_PRIVATE_KEY").replace( + "\\n", "\n" + ), + "scopes": ["https://www.googleapis.com/auth/spreadsheets.readonly"], + } credentials = service_account.Credentials.from_service_account_info( service_account_info, @@ -214,7 +214,7 @@ def cred_sign_up(**_): ] }, ).execute() - + if return_url: # Personalize thank-you page flask.session["form_details"] = { @@ -228,6 +228,7 @@ def cred_sign_up(**_): else: return flask.redirect("/thank-you") + @shop_decorator(area="cred", permission="user", response="html") def cred_schedule(ua_contracts_api, trueability_api, **_): error = None diff --git a/webapp/views.py b/webapp/views.py index 0c3d038ef4e..dbfc562eecf 100644 --- a/webapp/views.py +++ b/webapp/views.py @@ -29,8 +29,6 @@ DocParser, ) -from google.oauth2 import service_account -from googleapiclient.discovery import build # Local from webapp.login import user_info