Skip to content
Advertisement

Tag: validation

How to disable schema checking in FastAPI?

I am migrating a service from Flask to FastAPI and using Pydantic models to generate the documentation. However, I’m a little unsure about the schema check. I’m afraid there will be some unexpected data (like a different field format) and it will return an error. In the Pydantic documentation there are ways to create a model without checking the schema:

Dependencies validation using Cerberus

Am validating a CSV file with Cerberus but am struggling with what I’d assume is some basic logic Scenario: A CSV file has 2 columns. Column 2 requires to have a value only if Column 1 has a value. If Column 1 is empty then Column 2 should also be empty. Am thinking this would be one of the most

Using uk-postcode-utils in a python form

I am creating a form for the user to enter a valid UK postcode. I currently have the following code for the form: and the template is: but getting the error: TypeError: argument of type ‘StringField’ is not iterable. What can I do to fix this? Edit: Here are the complete form entry and the template for the webpage. Thanks

Asking the user for input until they give a valid response

I am writing a program that accepts user input. The program works as expected as long as the the user enters meaningful data. But it fails if the user enters invalid data: Instead of crashing, I would like the program to ask for the input again. Like this: How do I ask for valid input instead of crashing or accepting

How to check if a string is a valid regex in Python?

In Java, I could use the following function to check if a string is a valid regex (source): Is there a Python equivalent of the Pattern.compile() and PatternSyntaxException? If so, what is it? Answer Similar to Java. Use re.error exception: exception re.error Exception raised when a string passed to one of the functions here is not a valid regular expression

Interactively validating Entry widget content in tkinter

What is the recommended technique for interactively validating content in a tkinter Entry widget? I’ve read the posts about using validate=True and validatecommand=command, and it appears that these features are limited by the fact that they get cleared if the validatecommand command updates the Entry widget’s value. Given this behavior, should we bind on the KeyPress, Cut, and Paste events

Advertisement