From da96ca4eb57cec8d4eccc4e6873e5bb6dcd32148 Mon Sep 17 00:00:00 2001 From: Maximo Guerrero Date: Fri, 22 Mar 2019 18:43:40 -0400 Subject: [PATCH] Bug with flask httpauth The lesson 4 files have an outdated version of flask httpauth. Server students have brought this up. As well as adding to "?check_same_thread=False" to the session 4 database to bypass the sql thread errors. --- .../models.pyc | Bin 1574 -> 1550 bytes .../views.py | 4 +++- .../Solution Code/views.py" | 3 ++- .../starter_code/views.py" | 5 +++-- .../views.py | 3 ++- .../Solution Code/views.py | 5 +++-- .../starter_code/views.py | 5 +++-- 7 files changed, 16 insertions(+), 9 deletions(-) diff --git a/Lesson_4/04_Password Protecting a Resource/models.pyc b/Lesson_4/04_Password Protecting a Resource/models.pyc index c734696a4fab965c28cb3b83a7ad4401901063f1..d2e8399f05cc0b5d96280a4a3a428dfafe0b2e9d 100644 GIT binary patch delta 174 zcmZ3+)5pWX{F#?)@#?ggjT}>$6g(Li81%~$(~A=GO7tBAJd1U66N^hyi}Za`i;MH~ g;wMjK)|>o+sh${xrwA(A+{&WCNKh5nPDVCW0I_*Fm;e9( delta 201 zcmeCOC diff --git a/Lesson_4/04_Password Protecting a Resource/views.py b/Lesson_4/04_Password Protecting a Resource/views.py index e6a6ac2..834052a 100644 --- a/Lesson_4/04_Password Protecting a Resource/views.py +++ b/Lesson_4/04_Password Protecting a Resource/views.py @@ -1,10 +1,12 @@ +#!/usr/bin/python + from models import Base, User from flask import Flask, jsonify, request, url_for, abort, g from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.orm import relationship, sessionmaker from sqlalchemy import create_engine -from flask.ext.httpauth import HTTPBasicAuth +from flask_httpauth import HTTPBasicAuth auth = HTTPBasicAuth() diff --git "a/Lesson_4/05_Mom & Pop\342\200\231s Bagel Shop/Solution Code/views.py" "b/Lesson_4/05_Mom & Pop\342\200\231s Bagel Shop/Solution Code/views.py" index abb0186..833e1b8 100644 --- "a/Lesson_4/05_Mom & Pop\342\200\231s Bagel Shop/Solution Code/views.py" +++ "b/Lesson_4/05_Mom & Pop\342\200\231s Bagel Shop/Solution Code/views.py" @@ -1,9 +1,10 @@ +#!/usr/bin/python from models import Base, User, Bagel from flask import Flask, jsonify, request, url_for, abort, g from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.orm import relationship, sessionmaker from sqlalchemy import create_engine -from flask.ext.httpauth import HTTPBasicAuth +from flask_httpauth import HTTPBasicAuth auth = HTTPBasicAuth() diff --git "a/Lesson_4/05_Mom & Pop\342\200\231s Bagel Shop/starter_code/views.py" "b/Lesson_4/05_Mom & Pop\342\200\231s Bagel Shop/starter_code/views.py" index a88914b..967cc38 100644 --- "a/Lesson_4/05_Mom & Pop\342\200\231s Bagel Shop/starter_code/views.py" +++ "b/Lesson_4/05_Mom & Pop\342\200\231s Bagel Shop/starter_code/views.py" @@ -1,9 +1,10 @@ +#!/usr/bin/python from models import Base, User, Bagel from flask import Flask, jsonify, request, url_for, abort, g from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.orm import relationship, sessionmaker -from sqlalchemy import create_engine -from flask.ext.httpauth import HTTPBasicAuth +from sqlalchemy import create_enginefrom +from flask_httpauth import HTTPBasicAuth auth = HTTPBasicAuth() diff --git a/Lesson_4/07_Implementing Token-Based Authentication in Flask/views.py b/Lesson_4/07_Implementing Token-Based Authentication in Flask/views.py index ed81e4c..4f66f85 100644 --- a/Lesson_4/07_Implementing Token-Based Authentication in Flask/views.py +++ b/Lesson_4/07_Implementing Token-Based Authentication in Flask/views.py @@ -1,10 +1,11 @@ +#!/usr/bin/python from models import Base, User from flask import Flask, jsonify, request, url_for, abort, g from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.orm import relationship, sessionmaker from sqlalchemy import create_engine +from flask_httpauth import HTTPBasicAuth -from flask.ext.httpauth import HTTPBasicAuth auth = HTTPBasicAuth() diff --git a/Lesson_4/08 _Regal Tree Foods/Solution Code/views.py b/Lesson_4/08 _Regal Tree Foods/Solution Code/views.py index 878a105..cca7a46 100644 --- a/Lesson_4/08 _Regal Tree Foods/Solution Code/views.py +++ b/Lesson_4/08 _Regal Tree Foods/Solution Code/views.py @@ -1,14 +1,15 @@ +#!/usr/bin/python from models import Base, User, Product from flask import Flask, jsonify, request, url_for, abort, g from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.orm import relationship, sessionmaker from sqlalchemy import create_engine -from flask.ext.httpauth import HTTPBasicAuth +from flask_httpauth import HTTPBasicAuth auth = HTTPBasicAuth() -engine = create_engine('sqlite:///regalTree.db') +engine = create_engine('sqlite:///regalTree.db?check_same_thread=False') Base.metadata.bind = engine DBSession = sessionmaker(bind=engine) diff --git a/Lesson_4/08 _Regal Tree Foods/starter_code/views.py b/Lesson_4/08 _Regal Tree Foods/starter_code/views.py index 7e1f358..bcb59dc 100644 --- a/Lesson_4/08 _Regal Tree Foods/starter_code/views.py +++ b/Lesson_4/08 _Regal Tree Foods/starter_code/views.py @@ -1,14 +1,15 @@ +#!/usr/bin/python from models import Base, User, Product from flask import Flask, jsonify, request, url_for, abort, g from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.orm import relationship, sessionmaker from sqlalchemy import create_engine -from flask.ext.httpauth import HTTPBasicAuth +from flask_httpauth import HTTPBasicAuth auth = HTTPBasicAuth() -engine = create_engine('sqlite:///regalTree.db') +engine = create_engine('sqlite:///regalTree.db?check_same_thread=False') Base.metadata.bind = engine DBSession = sessionmaker(bind=engine)