By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,619 Members | 1,534 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,619 IT Pros & Developers. It's quick & easy.

Submit a post request to an asp.net form

P: 2
Using requests & beautiful soup to make a post request to an asp.net form However I've no luck in actually posting the website keeps redirecting to the login screen


this is how I build the form data
Expand|Select|Wrap|Line Numbers
  1.     soup = BeautifulSoup(page.content,features="lxml")
  2.     viewstate = soup.select_one("#__VIEWSTATE")["value"]
  3.     viewstategenerator = soup.select_one("#__VIEWSTATEGENERATOR")["value"]
  4.     lastfocus = soup.select_one("#__LASTFOCUS")["value"]
  5.     eventtarget = soup.select_one("#__EVENTTARGET")["value"]
  6.     eventargument = soup.select_one("#__EVENTARGUMENT")["value"]
  7.     data = {
  8.             r'ScriptManager1': r'UpdatePanel1|btnLogin',
  9.             r'__ASYNCPOST': r'true',
  10.             r'___VIEWSTATE': viewstate,
  11.             r'__VIEWSTATEGENERATOR': viewstategenerator,
  12.             r'__EVENTTARGET': eventtarget,
  13.             r'__EVENTARGUMENT': eventargument,
  14.             r'__LASTFOCUS': lastfocus,
  15.             r'ddlAuthentication': r'HRView Authentication',
  16.             r'tbUsername': r'odoo',
  17.             r'tbPassword': r'odoo', 
  18.             r'ddlCompany': r'1',
  19.             r'hfForceReset': r'False,False',
  20.             r'btnLogin': r'Login',
  21.  
  22.         }
  23.  
these are the only form data needed to make the post request & I've verified that from chrome developer tools

Attached Images
File Type: jpg Capture.jpg (105.6 KB, 100 views)
Jan 29 '19 #1
Share this Question
Share on Google+
1 Reply


P: 2
It doesn't seem that this parser is supported in bs4

https://www.crummy.com/software/Beau...lling-a-parser
Jan 31 '19 #2

Post your reply

Sign in to post your reply or Sign up for a free account.