# Webservices NTLM Auth

**URL:** <https://forum.inductiveautomation.com/t/webservices-ntlm-auth/12656>\
**Category:** General Discussion\
**Created:** [February 8, 2017, 2:15pm UTC](https://forum.inductiveautomation.com/t/webservices-ntlm-auth/12656 "2017-02-08T14:15:30Z")\
**Posts on this page:** 1\
**Showing post:** 9

<div class="post-metadata">

**Author:** ![ryanjmclaughlin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ryanjmclaughlin/32/4318_2.png) [@ryanjmclaughlin](https://forum.inductiveautomation.com/u/ryanjmclaughlin)\
**Post date:** [March 16, 2020, 3:42pm UTC](https://forum.inductiveautomation.com/t/webservices-ntlm-auth/12656/9 "2020-03-16T15:42:01Z")

</div>

After some playing around I was able to setup a basic HTTP GET using Java and supplying NTLM auth.

However, I am finding that I am getting import errors in the Gateway Scope, but not in the Designer scope. I am running the same Java (8.231) on both designer and gateway, is there some odd difference in context of why the below might fail?

```auto
# Perform a basic HTTP Get to the provided URL using the NTLM auth in the function
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
	
	# Setup the client with NTLM Auth
	httpclient = DefaultHttpClient()
	
	# Define the credentials to use
	creds = NTCredentials("USERNAME", "PASSWORD", system.net.getHostName(), "DOMAINHERE")
	httpclient.getCredentialsProvider().setCredentials(AuthScope.ANY, creds)
	
	# Define the host and URL to call
	httpget = HttpGet(url)
	
	# Execute the request
	response = httpclient.execute(httpget)   
	
	# Handle the response
	content = BasicResponseHandler().handleResponse(response)
	contentType = ContentType.getOrDefault(response.getEntity()).getMimeType()
	
	# Return the result
	if 'json' in contentType.lower():
		return system.util.jsonDecode(content)
	else:
		return content

```

Results return fine in the Designer (script console). On the gateway, I get the following:

```auto
Traceback (most recent call last):
...
...
File "", line 33, in _httpGetNTLM
ImportError: No module named http

```

---

_[View the full topic](https://forum.inductiveautomation.com/t/webservices-ntlm-auth/12656)._
