Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- # -*- coding: utf-8 -*-
- #
- import requests
- datos = [
- {"name":"Alejandro", "email":"ale@email.com", "cursos": "Python"},
- {"name":"Ana", "email":"ale@email.com", "cursos": "Python"},
- {"name":"Victor", "email":"ale@email.com", "cursos": "Python"},
- {"name":"Jose", "email":"ale@email.com", "cursos": "Python"},
- {"name":"Vicky", "email":"ale@email.com", "cursos": "Python"},
- {"name":"Ruben", "email":"ale@email.com", "cursos": "Python"},
- {"name":"Luisa", "email":"ale@email.com", "cursos": "Python"},
- {"name":"Alberto", "email":"ale@email.com", "cursos": "Python"},
- ]
- url = "http://localhost:8880/form"
- for dato in datos:
- r = requests.post(url, data=dato)
- contenido = r.content.decode("utf-8")
- if "correctamente" in contenido:
- print(f"Datos del alumno {dato['name']} subidos correctamente")
- else:
- print(f"No se pudieron subir los datos del alumno {dato['name']}")
- print(f"Código de respuesta {r.status_code}")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement