I need to create a python code that can fill out a web contact form with random data. The code should take emails from a JSON or text file, take names from a JSON or text file, messages from a list of messaged stored in messages.json or txt and same for "subject Field) and then visit a URL, fill these fields and then send the contact form,
we will set a limit to 20-30 contact form fills per time (day) and then it stops running, it will be ideal if it can send one form for every random amount of time between 30 Minutes to 2 Hours
So far what I have is not even close. I am relatively new to python
My Code so far:
import requests
import os
import random
import string
import json
chars = string.ascii_letters + string.digits + '!@#$%^&*()'
random.seed = (os.urandom(1024))
url = 'https://www.webiste.com/contact.php'
names = json.loads(open('names.json').read())
for name in names:
name_extra = ''.join(random.choice(string.digits))
for email in emails:
email_extra = email
requests.post(url, allow_redirects=False, data={
sent_name = name_extra
sent_email = email_extra
subject = ''
message = ''
})
print 'Form Filled and Submited'
Aucun commentaire:
Enregistrer un commentaire