# Script Console cryptography for HttpNtlmAuth requests.get Import Error

**URL:** <https://forum.inductiveautomation.com/t/script-console-cryptography-for-httpntlmauth-requests-get-import-error/102802>\
**Category:** Ignition\
**Created:** [February 24, 2025, 5:25pm UTC](https://forum.inductiveautomation.com/t/script-console-cryptography-for-httpntlmauth-requests-get-import-error/102802 "2025-02-24T17:25:50Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![ryan.white](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ryan.white/32/73193_2.png) [@ryan.white](https://forum.inductiveautomation.com/u/ryan.white)\
**Post date:** [February 24, 2025, 7:33pm UTC](https://forum.inductiveautomation.com/t/script-console-cryptography-for-httpntlmauth-requests-get-import-error/102802/4 "2025-02-24T19:33:34Z")

</div>

Post code, not pictures of code. It helps with searching via text. Please see [Wiki - how to post code on this forum](https://forum.inductiveautomation.com/t/wiki-how-to-post-code-on-this-forum/77831). You can edit your post by clicking the pencil icon on the bottom right.

Edit: Code for those searching:

> **Original**
>
> ```python
> url = 'MY URL'
> un = 'MY USERNAME'
> do = 'MY DOMAIN'
> pwd = 'MY PASSWORD'
> 
> # Import
> import org.apache.http.auth.AuthScope;
> import org.apache.http.auth.NTCredentials;
> import org.apache.http.impl.client.BasicCredentialsProvider;
> import org.apache.http.client.methods.HttpGet
> import org.apache.http.util.EntityUtils
> 
> credProv	= org.apache.http.impl.client.BasicCredentialsProvider()	# Build credentials provider
> ntCred = org.apache.http.auth.NTCredentials(un, pwd, '', do) # Build NT domain credentials
> credProv.setCredentials(org.apache.http.auth.AuthScope.ANY, ntCred);	# Set credentials
> bld = org.apache.http.impl.client.HttpClientBuilder.create()	# Create HttpClientBuilder
> client = bld.setDefaultCredentialsProvider(credProv).build() # Build client with credential proxy
> 
> get = org.apache.http.Client.methods.HttpGet(url)	# Define http get
> res = client.execute(get) # Execute get
> 
> # Result string
> ress = str(org.apache.http.util.EntityUtils.toString(res.getEntity(), 'UTF-8'))
> 
> ```

> **Slimmed**
>
> ```python
> from org.apache.http.auth import AuthScope, NTCredentials
> from org.apache.http.impl.client import BasicCredentialsProvider, HttpClientBuilder
> from org.apache.http.client.methods import HttpGet
> from org.apache.http.util import EntityUtils
> 
> url = 'MY URL'
> un = 'MY USERNAME'
> do = 'MY DOMAIN'
> pwd = 'MY PASSWORD'
> 
> credProv	= BasicCredentialsProvider() # Build credentials provider
> ntCred = NTCredentials(un, pwd, '', do)	# Build NT domain credentials
> credProv.setCredentials(AuthScope.ANY, ntCred);	# Set credentials
> 
> bld = HttpClientBuilder.create() # Create HttpClientBuilder
> client = bld.setDefaultCredentialsProvider(credProv).build()	# Build client with credential proxy
> 
> get = HttpGet(url) # Define http get
> res = client.execute(get)	# Execute get
> 
> # Result string
> ress = str(EntityUtils.toString(res.getEntity(), 'UTF-8'))
> 
> ```

---

_[View the full topic](https://forum.inductiveautomation.com/t/script-console-cryptography-for-httpntlmauth-requests-get-import-error/102802)._
