@@ -140,7 +140,7 @@ def make_content_disposition_header(fn):
140140from subprocess import STDOUT
141141from os import walk
142142import logging
143- import _io
143+ import io
144144
145145log_path = os .getenv ('TIKA_LOG_PATH' , tempfile .gettempdir ())
146146log_file = os .path .join (log_path , 'tika.log' )
@@ -326,7 +326,7 @@ def parse1(option, urlOrPath, serverEndpoint=ServerEndpoint, verbose=Verbose, ti
326326 service = services .get (option , services ['all' ])
327327 if service == '/tika' : responseMimeType = 'text/plain'
328328 headers .update ({'Accept' : responseMimeType , 'Content-Disposition' : make_content_disposition_header (path .encode ('utf-8' ) if type (path ) is unicode_string else path )})
329- with urlOrPath if type (urlOrPath ) is _io . BufferedReader else open (path , 'rb' ) as f :
329+ with urlOrPath if isinstance (urlOrPath , io . BufferedIOBase ) else open (path , 'rb' ) as f :
330330 status , response = callServer ('put' , serverEndpoint , service , f ,
331331 headers , verbose , tikaServerJar , config_path = config_path ,
332332 rawResponse = rawResponse , requestOptions = requestOptions )
@@ -699,8 +699,8 @@ def getRemoteFile(urlOrPath, destPath):
699699 :param destPath: path to store the resource, usually a path on file system
700700 :return: tuple having (path, 'local'/'remote'/'binary')
701701 '''
702- #update to handle binary stream input
703- if type (urlOrPath ) is _io . BufferedReader :
702+ # handle binary stream input
703+ if isinstance (urlOrPath , io . BufferedIOBase ) :
704704 return (urlOrPath .name , 'binary' )
705705
706706 urlp = urlparse (urlOrPath )
0 commit comments