Here is what I use, can work for files just need to modify the return...
def httpGetNTLM(url):
from org.apache.http.auth import AuthScope
from org.apache.http.auth import NTCredentials
from org.apache.http.client.methods import HttpGet
from org.apache.http.impl.client import DefaultHttpClient
from org.apache.http.impl.client import BasicResponseHandler
from org.apache.http.entity import ContentType
from java.io import ByteArrayOutputStream
# Setup the client with NTLM Auth
httpclient = DefaultHttpClient()
# Define the credentials to use
creds = NTCredentials(username, password, system.net.getHostName(), "DOMAIN")
httpclient.getCredentialsProvider().setCredentials(AuthScope.ANY, creds)
# Define the host and URL to call
httpget = HttpGet(url)
# Execute the request
response = httpclient.execute(httpget)
# Get response entity and MIME type
entity = response.getEntity()
contentType = ContentType.getOrDefault(response.getEntity()).getMimeType().lower()
# Return the result
if 'json' in contentType:
return system.util.jsonDecode(BasicResponseHandler().handleResponse(response))
elif contentType in ["image/png", "image/jpeg"]:
baos = ByteArrayOutputStream()
entity.writeTo(baos)
return baos.toByteArray(), contentType
else:
return BasicResponseHandler().handleResponse(response), contentType