Advertisement
Guest User

Untitled

a guest
Aug 23rd, 2018
698
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. import requests
  2. from bs4 import BeautifulSoup
  3.  
  4. username = 'user'
  5. password = 'pass'
  6. scrape_url = 'http://www.ivolatility.com/options.j?ticker=SPX&lhid=141519256'
  7.  
  8. login_url = 'https://www.ivolatility.com/login.j'
  9. login_info = {'email': username,'password': password}
  10.  
  11. #Start session.
  12. session = requests.session()
  13.  
  14. #Login using your authentication information.
  15. session.post(url=login_url, data=login_info)
  16.  
  17. #Request page you want to scrape.
  18. url = session.get(url=scrape_url)
  19.  
  20. soup = BeautifulSoup(url.content, 'html.parser')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement