PacktPublishing / Python-Programming-Blueprints

Python Programming Blueprints, published by Packt
MIT License
80 stars 57 forks source link

500 Internal Server error #24

Open stanleesocca opened 3 years ago

stanleesocca commented 3 years ago

Hi Thanks for this amazing book. I've been studying the codes detailed in this book and trying it out for myself. However, I have an issue that I can't figure how to resolve for Chapter 2. I still get stuck in "Authorizing our application with authorization code flow" section whenever I type python spotify_auth.py it produce a callback error with:

Internal Server Error The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.

In the browser (microsoft edge). In the terminal I get


Traceback (most recent call last):
  File "C:\Users\john\Desktop\Albert Corner\Mini - Projects\Python Tutorial\musicterminal\lib\site-packages\flask\app.py", line 2447, in wsgi_app
    response = self.full_dispatch_request()
  File "C:\Users\john\Desktop\Albert Corner\Mini - Projects\Python Tutorial\musicterminal\lib\site-packages\flask\app.py", line 1952, in full_dispatch_request 
    rv = self.handle_user_exception(e)
  File "C:\Users\john\Desktop\Albert Corner\Mini - Projects\Python Tutorial\musicterminal\lib\site-packages\flask\app.py", line 1821, in handle_user_exception 
    reraise(exc_type, exc_value, tb)
  File "C:\Users\john\Desktop\Albert Corner\Mini - Projects\Python Tutorial\musicterminal\lib\site-packages\flask\_compat.py", line 39, in reraise
    raise value
  File "C:\Users\john\Desktop\Albert Corner\Mini - Projects\Python Tutorial\musicterminal\lib\site-packages\flask\app.py", line 1950, in full_dispatch_request 
    rv = self.dispatch_request()
  File "C:\Users\john\Desktop\Albert Corner\Mini - Projects\Python Tutorial\musicterminal\lib\site-packages\flask\app.py", line 1936, in dispatch_request      
    return self.view_functions[rule.endpoint](**req.view_args)
  File "spotify_auth.py", line 41, in callback
    response = _authorization_code_request(code)
  File "spotify_auth.py", line 71, in _authorization_code_request
    content = json.loads(response.content.decode('utf-8'))
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.1776.0_x64__qbz5n2kfra8p0\lib\json\__init__.py", line 357, in loads
    return _default_decoder.decode(s)
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.1776.0_x64__qbz5n2kfra8p0\lib\json\decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.1776.0_x64__qbz5n2kfra8p0\lib\json\decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)```

I'm not sure what to make of this and how to bypass this one. Any help? 
dfurtado commented 3 years ago

Hi @stanleesocca thank you so much for going through the book, glad you liked it so far. I'm going to take a look at this issue and try to help you.

I will investigate and come back to you soon as I have a solution.

Best,

//Daniel

stanleesocca commented 3 years ago

Thanks Daniel. Sorry for my late response. Still haven't had any luck with that part. Hope we get a solution soon.

Regards, Stan