I'm new to the world of Python. My question is what is the best way (if any way is already done without doing it by hand) to perform validations of object attributes in Python.
The task is that when I receive data coming to me in a JSON
from the client (for example an HTTP
request to create an article), I want to check that this data is good (It is not a string when it should be an int (age), etc).
I have an object, and the object has the field age, i don't want to do this always. I want somethig that do it for me.
if age >= 18:
print("You are able to vote in the United States!")
else:
print("You are not able to vote in the United States.")
I've looked for several things but I can't find a good module or library to perform this important validation task. If anyone knows one with good documentation or shows an example, it would be appreciated.