Advertisement
Guest User

Untitled

a guest
Feb 9th, 2018
264
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. Hi I am trying to login to an outlook web application using python web crawler but I am not getting through the login page. From what I noticed the site will redirect upon the get request and set a cookie; namely OutlookSession. Then the post request goes to the same url having this cookie and this is the reason I am using requests.Session().
  2. This is my code:
  3. ```
  4. import requests
  5.  
  6. URL = "https://mail.guc.edu.eg/owa"
  7.  
  8. username = "username"
  9. password = "password"
  10.  
  11. s = requests.Session()
  12. s.get(URL)
  13. login_data={"username":username, "password":password}
  14. r = s.post("https://mail.guc.edu.eg/owa", data=login_data)
  15. ```
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement