python - Authentication issue using requests on aspx site -


i trying use requests (python) grab pages website requires me logged in. did inspect login page check out username , password headers. found names fields not standard 'username', 'password' used sites can see below screenshots

password field

i used them way in python script each time 'wrong syntax' error. sublimetext displayed part of name in orange can see pix below

from know there must problem name. try escape $ signs did not help. login.aspx header disappears before google chrome register on network.

the site www dot bncnetwork dot net

i'd happy if me figure out this.

here code`import requests

import requests  def get_project_page(seed_page):     username = "*******************"    password = "*******************"     bnc_login = dict(ctl00$maincontent$txtemailid=username, ctl00$maincontent$txtpassword=password)    sess_req = requests.session()    sess_req.get(seed_page)    sess_req.post(seed_page, data=bnc_login, headers={"referer":"http://www.bncnetwork.net/mybnc.aspx"})  page = sess_req.get(seed_page)  return page.text` 

you need use strings keys, $ cause syntax error if don't:

  data = {"ctl00$maincontent$txtpassword":password, "ctl00$maincontent$txtemailid":email} 

there evenvalidation fileds etc.. filled in also, follow logic answer fill them out, fields can seen in chrome tools:

enter image description here


Comments

Popular posts from this blog

jOOQ update returning clause with Oracle -

java - Warning equals/hashCode on @Data annotation lombok with inheritance -

java - BasicPathUsageException: Cannot join to attribute of basic type -