Advertisement
teslariu

automa

Nov 8th, 2021
790
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. #
  4. import requests
  5.  
  6. ale = {"name":"ale", "email":"ale@ale.com", "message":"Hola"}
  7. tito = {"name":"tito", "email":"tito@ale.com", "message":"Hola"}
  8. roque = {"name":"roque", "email":"roque@ale.com", "message":"Hola"}
  9. ana = {"name":"ana", "email":"ana@ale.com", "message":"Hola"}
  10. luisa = {"name":"luisa", "email":"luisa@ale.com", "message":"Hola"}
  11.  
  12. datos = [ale, tito, roque, ana, luisa]
  13.  
  14. for dato in datos:
  15.     r = requests.post("http://localhost:8880/form", data=dato)
  16.     if "correctamente" in r.content.decode("utf-8"):
  17.         print(f"Datos de {dato['name']} subidos correctamente")
  18.     else:
  19.         print(f"Error en envío de los datos de {dato['name']}")
  20.        
  21.  
  22.  
Advertisement
RAW Paste Data Copied
Advertisement