Debian Codegraph @

autotests/samplefiles/testexternalextractor/main.py

raw
1 #!@Python3_EXECUTABLE@
2 #
3 # SPDX-FileCopyrightText: 2016 Varun Joshi <[email protected]>
4 #
5 # SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
6
7 import sys
8 import json
9
10 extractor_data = json.loads(sys.stdin.read())
11
12 def extract():
13 path = extractor_data.get('path')
14 mimetype = extractor_data.get('mimetype')
15
16 doc = open(path)
17
18 return_value = {}
19 return_value['properties'] = {}
20 return_value['properties']['text'] = doc.read()
21 return_value['status'] = 'OK'
22 return_value['error'] = ''
23
24 print(json.dumps(return_value))
25
26 if __name__ == "__main__":
27 extract()