2024年4月15日星期一

[Python]Use Python to send form data to page

 Consider to request a form URL to get the site accept the data.

import requests # Define the form data form_data = { 'name': 'G X', 'email': 'gx@gx.com' } # Send a POST request with the form data response = requests.post('http://gx.com/submit', data=form_data) # Check if the request was successful (status code 200) if response.status_code == 200: print('Form submitted successfully') else: print('Failed to submit the form')


But actually, it won't work for the site I had expected.

Because the site will use a one-time serial session id to identify the request. need to update.

Yes, you are right. this is a tips for company timecard registration automation. 

 

没有评论:

发表评论