Skip to content Skip to sidebar Skip to footer

Python Dryscrape Scrape Page With Cookies

I wanna get some data from site, which requires loggin in. I log in by requests url = 'http://example.com' response = requests.get(url, {'email':'a@gmail.com', 'password':'12345'})

Solution 1:

Why not login by dryscrape?

session = dryscrape.Session()
session.visit('<url_where_is_login_form>')
name = session.at_xpath('//*[@name="username"]') # Where <input name="username">
name.set("<login>")
password = session.at_xpath('//*[@name="password"]') # Where <input name="password">
password.set("<password>")
# Push the button
name.form().submit()
session.visit("<url to visit with proper cookies>")

Post a Comment for "Python Dryscrape Scrape Page With Cookies"