0

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.

pam
  • 1,175
  • 5
  • 15
  • 28

1 Answers1

1

Maybe i am mistaken, but AngularJS is a JS-Framework. That means that the Login-Form is rendered by the browser on runtime and not present in the pure HTML code. The Packages you mentined do not render JS. They only download the sourcecode. Maybe have a look here on how to work with JS-based websites: Is there a way to use PhantomJS in Python?

Community
  • 1
  • 1
Rentrop
  • 20,979
  • 10
  • 72
  • 100