mardi 19 juillet 2016

Scrape and login to angular webabb using Python

I'm trying to login to an angular webapp.

I tried using multiple packages like requests, urllib, mechanize etc., but can't figure out what I'm missing/ is going wrong. Here's the code:

import requests
from requests.utils import quote

session = requests.Session()
session.cookies.get_dict()
url = 'https://my.url.com'
authentication = {"username":"name","password":"pswd","domain":"domain_id","rURL":"https://another.url.com/something"}
reqs = requests.post(url)
response = session.get(reqs.url)
new_req = requests.post(url, data = authentication)
print new_req.text

However, it doesn't log me in and prints the login page again.

Aucun commentaire:

Enregistrer un commentaire