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) 

    1 answer 1

    It seems that the server, that is, the script with the code from the listing, is not running. First you need to start the server

     (venv) user@hameleon:~/lessons/api$ python app.py 

    And then connect with the client http or from the browser to go

     user@hameleon:~/lessons/api$ http localhost:8000/quote 
    • We will try, thank you - Dmitriy