简体   繁体   中英

How i post data on search-Bar website using python script?

As all we know in web application we have get method and post data method. Here my problem appear with post data. For example i want to make my python code that access for search bar of website by insert same values and submit (the website button), then check for the page. How the code gonna be then if there any documentation about this python concepts! I am totally confused Note : i am just beginner in python.

If the website relies on javascript, you're going to need to use something like Selenium which will emulate a typical browser and allow you to insert information onto a page and execute javascript commands.

If, however, the search bar simply posts data to a URL. You can determine that URL and then use requests to post the data and retrieve the result.

resp = requests.post('http://website/search', data = {'term':'value'})

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM