예제 #1
0
    def test_410_without_body(self, client):
        client.app.add_route('/410', GoneResource())
        response = client.simulate_request(path='/410')

        assert response.status == falcon.HTTP_410
        assert response.content == falcon.HTTPGone().to_json()
        assert response.json == {'title': '410 Gone'}
 def on_get(self, req, resp):
     """Execution of the GET named graph request."""
     graph_uri = req.get_param('uri')
     fuseki = GraphStore()
     response = fuseki._graph_retrieve(graph_uri)
     if response is not None:
         resp.data = str(response)
         resp.content_type = 'text/turtle'
         app_logger.info('Retrieved: {0}.'.format(graph_uri))
         resp.status = falcon.HTTP_200
     else:
         raise falcon.HTTPGone()
예제 #3
0
 def on_get(self, req, resp, indexID):
     """Respond on GET request to index endpoint."""
     data = IndexingData()
     response = data.retrieve_indexID(indexID)
     if response is not None:
         resp.data = json.dumps(response, indent=1, sort_keys=True)
         resp.content_type = 'application/json'
         resp.status = falcon.HTTP_200
         app_logger.info(
             'GET /index the data with ID: {0}.'.format(indexID))
     else:
         raise falcon.HTTPGone()
         app_logger.warning(
             'Indexing job with ID: {0} is gone/deleted.'.format(indexID))
예제 #4
0
 def on_get(self, req, resp):
     raise falcon.HTTPGone(description='Gone with the wind')
예제 #5
0
 def on_get(self, req, resp):
     raise falcon.HTTPGone()