You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Small patch contributed by Gregg Morris <[email protected]> to provide parse status in the returned dict from _parse method.
```
Hi Chris--
For my purposes it's very helpful to know why a call to (in my case) parser.from_buffer() returns an empty dictionary. The status code returned by the tika server is a fine solution to that. The status code from the server is passed to the _parse() function, so I added "status" to the "parsed" dictionary and put the code there, regardless of anything else returned in that dictionary.
This may certainly fall into the category of "nobody else cares", but in case you think it's worthwhile, here's the patch:
diff --git a/tika/parser.py b/tika/parser.py
index 2cc2e07..84b4c88 100644
--- a/tika/parser.py
+++ b/tika/parser.py
@@ -42,7 +42,8 @@ def _parse(jsonOutput):
parsed={}
if not jsonOutput:
return parsed
- elif jsonOutput[1] == None or jsonOutput[1] == "":
+ parsed["status"] = jsonOutput[0]
+ if jsonOutput[1] == None or jsonOutput[1] == "":
return parsed
realJson = json.loads(jsonOutput[1])
Thanks for your tika efforts!
Gregg
```
0 commit comments