2016年6月14日 星期二

[python] auth with NTLM server & install python3.4 with requests_ntlm

Install requests_ntlm



1. need install request
2. install python-ntlm3
=>by download source code,

go to the folder you extracted files.
and use command

"sudo python3.4 setup.py install"

to install it.

3.install requests_ntlm
source code:https://github.com/requests/requests-ntlm

go to the folder you extracted files.
and the same, use command 
"sudo python3.4 setup.py install"


Done.

 ----------------------------------------------------------------------------

    from requests_ntlm import HttpNtlmAuth

    rs_aps = requests.session()
    url='http://xxxxx.xxxx.com/'
    res = rs_aps.get(url, auth=HttpNtlmAuth('domain\\account', 'passwd'))
    res.encoding='big5'
    #print(res.text)
    #get cookies
    #cookie will change every time
    for c in res.cookies:
        ASP_Cookies_name=c.name
        ASP_Cokies_value=c.value
        print(ASP_Cookies_name, ASP_Cokies_value)



沒有留言:

張貼留言