Guest User

Untitled

a guest
Jan 31st, 2018
169
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. #-*-coding:utf8-*-
  2. import urllib
  3. import http.cookiejar
  4.  
  5. url = 'https://joffice.jeunesseglobal.com/members/back_office.asp'
  6. login_url = "https://joffice.jeunesseglobal.com/login.asp"
  7. login_username = "jianghong181818"
  8. login_password = "Js@168168!"
  9.  
  10. login_data = {
  11. "Username" : login_username,
  12. "pw" : login_password,
  13. }
  14.  
  15. post_data = urllib.parse.urlencode(login_data).encode('utf-8')
  16.  
  17.  
  18. headers = {'User-agent':'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.113 Safari/537.36'}
  19.  
  20. req = urllib.request.Request(login_url, headers = headers, data = post_data)
  21.  
  22. cookie = http.cookiejar.CookieJar()
  23.  
  24. opener = urllib.request.build_opener(urllib.request.HTTPCookieProcessor(cookie))
  25.  
  26. resp = opener.open(req)
  27. print(resp.read().decode('utf-8'))
Add Comment
Please, Sign In to add comment