Remove BestBuy API requirement, or make it optional?
burvilc opened this issue · 1 comments
burvilc commented
I get the following error when I go through the steps in the README and run start.sh. I got around this by setting products = "hello" instead of products = req.json()['products']. Since the goal here isn't to buy BestBuy products, can you make it an option to turn that if not desired?
`
(myenv) burvil@antioch:~/bin/python/flask-blueprint-tutorial$ bash -xv start.sh
export FLASK_APP=wsgi.py
- export FLASK_APP=wsgi.py
- FLASK_APP=wsgi.py
export FLASK_DEBUG=1 - export FLASK_DEBUG=1
- FLASK_DEBUG=1
export APP_CONFIG_FILE=config.py - export APP_CONFIG_FILE=config.py
- APP_CONFIG_FILE=config.py
flask run - flask run
- Serving Flask app "wsgi.py" (lazy loading)
- Environment: development
- Debug mode: on
- Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
- Restarting with stat
- Debugger is active!
- Debugger PIN: 127-832-425
127.0.0.1 - - [23/Jun/2020 23:26:51] "GET / HTTP/1.0" 500 -
Traceback (most recent call last):
File "/home/username/bin/python/flask-blueprint-tutorial/flask_blueprint_tutorial/myenv/lib/python3.6/site-packages/flask/app.py", line 2464, in call
return self.wsgi_app(environ, start_response)
File "/home/username/bin/python/flask-blueprint-tutorial/flask_blueprint_tutorial/myenv/lib/python3.6/site-packages/flask/app.py", line 2450, in wsgi_app
response = self.handle_exception(e)
File "/home/username/bin/python/flask-blueprint-tutorial/flask_blueprint_tutorial/myenv/lib/python3.6/site-packages/flask/app.py", line 1867, in handle_exception
reraise(exc_type, exc_value, tb)
File "/home/username/bin/python/flask-blueprint-tutorial/flask_blueprint_tutorial/myenv/lib/python3.6/site-packages/flask/_compat.py", line 39, in reraise
raise value
File "/home/username/bin/python/flask-blueprint-tutorial/flask_blueprint_tutorial/myenv/lib/python3.6/site-packages/flask/app.py", line 2447, in wsgi_app
response = self.full_dispatch_request()
File "/home/username/bin/python/flask-blueprint-tutorial/flask_blueprint_tutorial/myenv/lib/python3.6/site-packages/flask/app.py", line 1952, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/home/username/bin/python/flask-blueprint-tutorial/flask_blueprint_tutorial/myenv/lib/python3.6/site-packages/flask/app.py", line 1821, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "/home/username/bin/python/flask-blueprint-tutorial/flask_blueprint_tutorial/myenv/lib/python3.6/site-packages/flask/_compat.py", line 39, in reraise
raise value
File "/home/username/bin/python/flask-blueprint-tutorial/flask_blueprint_tutorial/myenv/lib/python3.6/site-packages/flask/app.py", line 1950, in full_dispatch_request
rv = self.dispatch_request()
File "/home/username/bin/python/flask-blueprint-tutorial/flask_blueprint_tutorial/myenv/lib/python3.6/site-packages/flask/app.py", line 1936, in dispatch_request
return self.view_functionsrule.endpoint
File "/home/username/bin/python/flask-blueprint-tutorial/flask_blueprint_tutorial/home/home.py", line 18, in home
products = fetch_products(app)
File "/home/username/bin/python/flask-blueprint-tutorial/flask_blueprint_tutorial/api.py", line 17, in fetch_products
products = req.json()['products']
KeyError: 'products'`
toddbirchard commented
I left the bestbuy API dependency in there out of sheer laziness... you’re right, I should definitely take this out. thanks for reminding me!