Skip to content

Commit 3db203e

Browse files
committed
Update dependencies
1 parent 8a72238 commit 3db203e

File tree

18 files changed

+111
-150
lines changed

18 files changed

+111
-150
lines changed
Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
1-
Flask==2.2.2
2-
SQLAlchemy==1.4
3-
Flask_SQLAlchemy==2.5.1
4-
Flask_WTF==1.0.0
5-
google_api_python_client==2.56.0
6-
google_auth_oauthlib==0.4.6
7-
protobuf==4.21.5
8-
requests==2.27.1
9-
WTForms==3.0.1
10-
Werkzeug==2.3.7
1+
Flask==3.1.1
2+
flask_sqlalchemy==3.1.1
3+
flask_wtf==1.2.2
4+
google_api_python_client==2.172.0
5+
google_auth_oauthlib==1.2.2
6+
protobuf==6.31.1
7+
Requests==2.32.4
8+
WTForms==3.2.1

flask/02-sign-in/requirements.txt

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
1-
Flask==2.2.2
2-
SQLAlchemy==1.4
3-
Flask_SQLAlchemy==2.5.1
4-
Flask_WTF==1.0.0
5-
google_api_python_client==2.56.0
6-
google_auth_oauthlib==0.4.6
7-
protobuf==4.21.5
8-
requests==2.27.1
9-
WTForms==3.0.1
10-
Werkzeug==2.3.7
1+
Flask==3.1.1
2+
flask_sqlalchemy==3.1.1
3+
flask_wtf==1.2.2
4+
google_api_python_client==2.172.0
5+
google_auth_oauthlib==1.2.2
6+
protobuf==6.31.1
7+
Requests==2.32.4
8+
WTForms==3.2.1
Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
1-
Flask==2.2.2
2-
SQLAlchemy==1.4
3-
Flask_SQLAlchemy==2.5.1
4-
Flask_WTF==1.0.0
5-
google_api_python_client==2.56.0
6-
google_auth_oauthlib==0.4.6
7-
protobuf==4.25.8
8-
requests==2.27.1
9-
WTForms==3.0.1
10-
Werkzeug==2.3.7
1+
Flask==3.1.1
2+
flask_sqlalchemy==3.1.1
3+
flask_wtf==1.2.2
4+
google_api_python_client==2.172.0
5+
google_auth_oauthlib==1.2.2
6+
protobuf==6.31.1
7+
Requests==2.32.4
8+
WTForms==3.2.1

flask/03-query-parameters/webapp/__init__.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828

2929
from webapp import routes, models
3030

31-
# Initialize the database file if not created.
32-
if not path.exists(config.DATABASE_FILE_NAME):
33-
db.create_all()
31+
with app.app_context():
32+
# Initialize the database file if not created.
33+
if not path.exists(config.DATABASE_FILE_NAME):
34+
db.create_all()
Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
1-
Flask==2.2.2
2-
SQLAlchemy==1.4
3-
Flask_SQLAlchemy==2.5.1
4-
Flask_WTF==1.0.0
5-
google_api_python_client==2.56.0
6-
google_auth_oauthlib==0.4.6
7-
protobuf==4.21.5
8-
requests==2.27.1
9-
WTForms==3.0.1
10-
Werkzeug==2.3.7
1+
Flask==3.1.1
2+
flask_sqlalchemy==3.1.1
3+
flask_wtf==1.2.2
4+
google_api_python_client==2.172.0
5+
google_auth_oauthlib==1.2.2
6+
protobuf==6.31.1
7+
Requests==2.32.4
8+
WTForms==3.2.1

flask/04-content-attachments/webapp/__init__.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
from webapp import attachment_routes, attachment_discovery_routes, models
3030
from webapp import credential_handler as ch
3131

32-
# Initialize the database file if not created.
33-
if not path.exists(config.DATABASE_FILE_NAME):
34-
db.create_all()
32+
with app.app_context():
33+
# Initialize the database file if not created.
34+
if not path.exists(config.DATABASE_FILE_NAME):
35+
db.create_all()

flask/04-content-attachments/webapp/credential_handler.py

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -127,15 +127,9 @@ def get_credentials_from_storage(self, id):
127127
flask.session["credentials"]["token"] = (
128128
flask.session.get("credentials").get("token") or None
129129
)
130-
flask.session["credentials"][
131-
"refresh_token"
132-
] = stored_credentials.refresh_token
133-
flask.session["credentials"]["token_uri"] = client_secrets_dict[
134-
"token_uri"
135-
]
136-
flask.session["credentials"]["client_id"] = client_secrets_dict[
137-
"client_id"
138-
]
130+
flask.session["credentials"]["refresh_token"] = stored_credentials.refresh_token
131+
flask.session["credentials"]["token_uri"] = client_secrets_dict["token_uri"]
132+
flask.session["credentials"]["client_id"] = client_secrets_dict["client_id"]
139133
flask.session["credentials"]["client_secret"] = client_secrets_dict[
140134
"client_secret"
141135
]
@@ -234,6 +228,7 @@ def clear_credentials_in_session(self):
234228
if "credentials" in flask.session:
235229
del flask.session["credentials"]
236230
del flask.session["username"]
231+
del flask.session["login_hint"]
237232

238233

239234
_credential_handler = CredentialHandler()
Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
1-
Flask==2.2.2
2-
SQLAlchemy==1.4
3-
Flask_SQLAlchemy==2.5.1
4-
Flask_WTF==1.0.0
5-
google_api_python_client==2.56.0
6-
google_auth_oauthlib==0.4.6
7-
protobuf==4.21.5
8-
requests==2.27.1
9-
WTForms==3.0.1
10-
Werkzeug==2.3.7
1+
Flask==3.1.1
2+
flask_sqlalchemy==3.1.1
3+
flask_wtf==1.2.2
4+
google_api_python_client==2.172.0
5+
google_auth_oauthlib==1.2.2
6+
protobuf==6.31.1
7+
Requests==2.32.4
8+
WTForms==3.2.1

flask/05-activity-attachments/webapp/__init__.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
from webapp import attachment_routes, attachment_discovery_routes, models
3030
from webapp import credential_handler as ch
3131

32-
# Initialize the database file if not created.
33-
if not path.exists(config.DATABASE_FILE_NAME):
34-
db.create_all()
32+
with app.app_context():
33+
# Initialize the database file if not created.
34+
if not path.exists(config.DATABASE_FILE_NAME):
35+
db.create_all()

flask/05-activity-attachments/webapp/attachment_routes.py

Lines changed: 13 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,7 @@ class ImageListForm(FlaskForm):
4747
name_pairs = []
4848

4949
# For this example, images have the format "landmark-name.type".
50-
image_captions = [
51-
x.split(".")[0].replace("-", " ").title() for x in image_filenames
52-
]
50+
image_captions = [x.split(".")[0].replace("-", " ").title() for x in image_filenames]
5351

5452
# Add a checkbox for each image to the form, named by the image filename.
5553
for i in range(len(image_filenames)):
@@ -77,14 +75,11 @@ def construct_filename_caption_dictionary_list(form):
7775
A dictionary that maps image filenames to captions.
7876
"""
7977
selected_images = [
80-
key
81-
for key, value in form.data.items()
82-
if value is True and key != "submit"
78+
key for key, value in form.data.items() if value is True and key != "submit"
8379
]
8480

8581
filename_caption_pairs = {
86-
form[image_id].name: form[image_id].label.text
87-
for image_id in selected_images
82+
form[image_id].name: form[image_id].label.text for image_id in selected_images
8883
}
8984

9085
return filename_caption_pairs
@@ -178,9 +173,7 @@ def create_attachments(filename_caption_pairs):
178173
# Specifies the route for a teacher user when the attachment is
179174
# loaded in the Classroom grading view.
180175
"studentWorkReviewUri": {
181-
"uri": flask.url_for(
182-
"view_submission", _scheme="https", _external=True
183-
)
176+
"uri": flask.url_for("view_submission", _scheme="https", _external=True)
184177
},
185178
# The title of the attachment.
186179
"title": f"Attachment {attachment_count}",
@@ -272,9 +265,7 @@ def load_activity_attachment():
272265
# Redirect to the authorization page if we received login_hint but don't
273266
# have any stored credentials for this user. We need the refresh token
274267
# specifically.
275-
credentials = ch._credential_handler.get_credentials(
276-
flask.session["login_hint"]
277-
)
268+
credentials = ch._credential_handler.get_credentials(flask.session["login_hint"])
278269

279270
if credentials is None:
280271
return ch.start_auth_flow("attachment_callback")
@@ -317,9 +308,9 @@ def load_activity_attachment():
317308
# If the user is a student, get their submission status for this attachment.
318309
# Note that the submissionId was returned in the addOnContext response.
319310
else:
320-
flask.session["submissionId"] = addon_context_response.get(
321-
"studentContext"
322-
).get("submissionId")
311+
flask.session["submissionId"] = addon_context_response.get("studentContext").get(
312+
"submissionId"
313+
)
323314

324315
submission_response = (
325316
classroom_service.courses()
@@ -371,10 +362,8 @@ def load_activity_attachment():
371362

372363
return flask.render_template(
373364
"acknowledge-submission.html",
374-
message="Your response has been recorded. You can close the "
375-
"iframe now.",
376-
instructions="Please Turn In your assignment if you have "
377-
"completed all tasks.",
365+
message="Your response has been recorded. You can close the iframe now.",
366+
instructions="Please Turn In your assignment if you have completed all tasks.",
378367
)
379368

380369
# Show the activity. Disable the submission button if the user is a teacher.
@@ -407,9 +396,9 @@ def attachment_callback():
407396

408397
# Store credentials in the session.
409398
credentials = flow.credentials
410-
flask.session[
411-
"credentials"
412-
] = ch._credential_handler.session_credentials_to_dict(credentials)
399+
flask.session["credentials"] = ch._credential_handler.session_credentials_to_dict(
400+
credentials
401+
)
413402

414403
# Add or update the user's record in the database.
415404
ch._credential_handler.save_credentials_to_storage(credentials)

0 commit comments

Comments
 (0)