Skip to content

Commit

Permalink
Update indexer_controller.py
Browse files Browse the repository at this point in the history
  • Loading branch information
DiegoFHG authored May 2, 2020
1 parent 6078718 commit 8a72176
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion file_indexer_api/controllers/indexer_controller.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
from flask_restful import Resource, reqparse
from rpyc import connect

parser = reqparse.RequestParser()
parser.add_argument('path')

class IndexerController(Resource):
def post(self):
args = parser.parse_args()
connection = connect('localhost', 18861)
result = connection.root.index(args['path'])

return {'path': args['path']}
if (result is True):
return {'message': 'indexed path {}'.format(args['path'])}

return {'message': 'could no index path {}'.format(args['path'])}

0 comments on commit 8a72176

Please sign in to comment.