The guys started to learn Falcon , but when starting the page there was a problem, please tell me what am I doing wrong!
Logs:
(venv) user @ hameleon: ~ / lessons / api $ http localhost: 8000 / quote
http: error: ConnectionError: HTTPConnectionPool (host = 'localhost', port = 8000): Max retries exceeded with url: / quote (Caused by NewConnectionError (': Failed to connect a new connection: [Errno 111] Connection refused',) ) while doing GET request to URL: http: // localhost: 8000 / quote
Code:
import falcon class QuoteResource: def on_get(self, req, resp): """Handles GET requests""" resp.status = falcon.HTTP_200 resp.body = ('I\'ve always been more interested in the future than in the past.') app = api = falcon.API() quotes = QuoteResource() api.add_route('/quote', quotes)