I was trying to submit details through python on a form on the following website.
I tried requests but there is a search box on the site as well(another form).
How do I handle this? Sample data - TIN - 27680809621V
2 Answers 2
Try selenium or BeautifulSoup libraries
answered Apr 25, 2017 at 18:01
so1989
3271 gold badge3 silver badges9 bronze badges
Sign up to request clarification or add additional context in comments.
1 Comment
MooingRawr
How about providing an example in your answer. Right now your 'answer' is more of a comment than an actual answer.
Try using Mechanize, a library that supports interacting with forms, links and others when crawling or scraping data.
Something like this would be enough:
import mechanize
br = mechanize.Browser()
br.open('http://mahavat.gov.in/Tin_Search/Tinsearch.jsp')
br.select_form('f1')
br.form['tin'] = '27680809621V'
br.submit()
Here are some examples from StackOverflow on how to use Mechanize to fill forms:
answered Apr 25, 2017 at 18:01
Matheus Portela
2,4701 gold badge23 silver badges32 bronze badges
2 Comments
MooingRawr
If you are just going to recommend a library and link other answers on this site, why not comment and flag for duplication. Also this feels more of a comment than an answer.
Prateek Agarwal
I tried mechanize. I had problems with it. import mechanize br = mechanize.Browser() url = 'mahavat.gov.in/Tin_Search/Tinsearch.jsp' br.open(url) br.select_form(name='f1') It gave me the following error - TypeError: parse() got an unexpected keyword argument 'transport_encoding'
lang-py