Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0) #18

Open
timthurner opened this issue Mar 30, 2023 · 0 comments

Comments

@timthurner
Copy link

timthurner commented Mar 30, 2023

Hi ,

I added a simple route to the routes.py file

@rest_api.route('/hellos')
class TestProcedure(Resource):
	def get(self):
		hello =  {"hello": "test"}
		return jsonify(hello)

I also tried

@rest_api.route('/hellos')
class TestProcedure(Resource):
	def get(self):
		hello = "lol"
		return {"success": True}, 200

I always get this error i have to reload my page 2-3 times to get the actual result


Traceback (most recent call last):
  File "/usr/local/lib/python3.10/dist-packages/flask/app.py", line 2095, in __call__
    return self.wsgi_app(environ, start_response)
  File "/usr/local/lib/python3.10/dist-packages/flask/app.py", line 2080, in wsgi_app
    response = self.handle_exception(e)
  File "/usr/local/lib/python3.10/dist-packages/flask_cors/extension.py", line 165, in wrapped_function
    return cors_after_request(app.make_response(f(*args, **kwargs)))
  File "/usr/local/lib/python3.10/dist-packages/flask_restx/api.py", line 672, in error_router
    return original_handler(e)
  File "/usr/local/lib/python3.10/dist-packages/flask/app.py", line 2077, in wsgi_app
    response = self.full_dispatch_request()
  File "/usr/local/lib/python3.10/dist-packages/flask/app.py", line 1526, in full_dispatch_request
    return self.finalize_request(rv)
  File "/usr/local/lib/python3.10/dist-packages/flask/app.py", line 1547, in finalize_request
    response = self.process_response(response)
  File "/usr/local/lib/python3.10/dist-packages/flask/app.py", line 1889, in process_response
    response = self.ensure_sync(func)(response)
  File "/home/malpwn/latest_build/app-generator/api-server-flask/api/__init__.py", line 50, in after_request
    response_data = json.loads(response.get_data())
  File "/usr/lib/python3.10/json/__init__.py", line 346, in loads
    return _default_decoder.decode(s)
  File "/usr/lib/python3.10/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib/python3.10/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)


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant