2016年6月22日 星期三

[Coursera] Backup method. python3.4

ref: https://github.com/coursera-dl/coursera-dl
ref:http://www.owstartup.com/2016/06/17/how_to_download_coursera_courses_before_they_are_gone/


start:

1.
pip3 install coursera-dl

2.
go to folder which you want to download

3.
get url of the course you want to download . ex: https://class.coursera.org/prob-001

4. type
coursera-dl -u xxxxxxx@xxxx.com -p xxxxxx prob-001


5. start downloading...

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)