How can i validate an url and email with python voluptuous?

I want to validate url and email input data with python voluptuous, maybe something like this: schema = Schema({ Required('url'): All(str, Url()), Required('email'): All(str,...

Create (instantiate?) a reference to a built in type from its string name

I'd like to be able to define a schema in yaml, read it in using pyyaml and then validate with voluptuous (or other schema validator!). However, as stated in the question title, I run into the...

Simple python validation library which reports all validation errors instead of first failed?

I have tried voluptuous and schema, both of which are simple and great in validation, but they both do exception-based error reporting, i.e. they fail on first error. Is there a way I can get all...

Is this a valid structure for voluptuous or am I missing something

I've this YAML file. I've Required and Optional keys and also I've optional blocks, like 'linux', 'http' and so on. --- project: name: lolproj url: http://wiki.tld/lolproj contact: ...

PHP variables seem null after values set

These PHP values are outputting null data after I set the null variables to a value and post them onto the page. Does anyone know why? Here's my code: PHP: <?php $name = $_POST['query']; $cap =...

How to handle "413: Request Entity Too Large" in python flask server

I'm using Flask-uploads to upload files to my Flask server. The max size allowed is set by using flaskext.uploads.patch_request_class(app, 16 * 1024 * 1024). My client application (A unit test)...

p tag includes h1 if inside same section

I've encountered several times this issue and I would like to know why the browsers interpret the header inside the p tag. This breaks the layout as the elements have a margin applied to it,...

Are there any conditional rules for voluptuous?

Is there any way to define conditional rules using voluptuous? Here's the schema I have: from voluptuous import Schema, All, Any schema = Schema({ 'resolution': All(str, Any('1920x1080',...

decorator inside class not getting values

I have a decorator that validates a json response that I obtain using requests. I also wrapped some requests logic into a class which accepts a schema that the decorator needs to validate. I tried...

Can voluptuous code pass pylint?

I run pylint -E as part of the tests on my Python project to ensure that errors don't creep into untested code. Generally this works quite well. But recently I've been running into problems with...

Using ENUM datatype in many columns with list of values is good practice?

I am developing a dating website. In that project I use a mysql table named "users" and for this table I have used ENUM datatype for many columns. my "users" table looks like this : CREATE TABLE...

How to upload a variable amount of files using a single multipartform post header key

I have a repeatable form field: <div class="repeat"> <input type="file" name="files[==row-count-placeholder==]" /> </div> that will (using jQuery) for example result in <div class="repeat"> ...

voluptuous unable to handle unicode string?

I'm trying to use voluptuous to validate JSON input from HTTP request. However, it doesn't seem to handle unicode string to well. from voluptuous import Schema, Required from pprint import...

voluptuous: how to validate non-string value from json data in HTTP POST

I'm implementing some REST API with flask. In one of the APIs, I need to submit a location defined by longitude and latitude. So naturally I'm doing this with httpie: http POST :5000/api/v1.0/foo...

Hidden Div Not Showing Properly

I'm having an issue with a hidden div showing at the very end of a coldfusion loop. When I need it to show right underneath each individual row. You can see what i'm talking about at the URL below...

Handling a function argument with a decorator

At the core, what I'm trying to do is take a number of functions that look like this undecorated validation function: def f(k: bool): def g(n): # check that n is valid return...

Python data validation with multiple possible keys per entry

I am trying to write a data deserializer/validator in python. I have looked at several python tools for this, principally colander and voluptuous. My input data will always be in JSON...

Python: File being saved as empty when it should be saved with text in it, but only when an unrelated method is run before it

Observe the following Python file: # configmanager.py """ ConfigManager controls the modification and validation of config files. """ import os from ruamel import yaml from voluptuous import...

base64 leads to "TypeError: Can't convert 'bytes' object to str implicitly" error

I'm trying to send out a JSON message but the device I'm sending to requires the API Key to be encoded with base64. This is all being tied into a project called Home Assistant Here is my...

Voluptuous Exclusive Class

I am using voluptuous 0.9.2 and I have a problem with Exclusive class. I need that if there is none of the keys, it should give an error. However, this is okay for voluptuous. Is this a bug of...

Voluptuous 2 out of 3 class

I have been trying to use the python library voluptuous for a few hours but I cannot make what I want. Here is what is working right now : PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({ ...

Python - Cerberus, jsonschema, voluptous - Which one will be appropriate?

I am developing a small RESTful web application in python and using JSON as interface. The application accepts JSON data and needs to validate them against a schema. The schema may be very strict...

Python3 + pytest + pytest-mock: Mocks leaking into other test functions breaking assertions?

NOTE: All Details about my setup (python version, modules etc) listed at bottom of question. Apologies in advance if this issue is blatant, but i've been wrestling with it for several days now....

Pip error: Microsoft Visual C++ 14.0 is required

I just ran the following command: pip install -U steem and the installation worked well until it failed to install pycrypto. Afterwards I did the pip install cryptography command because I...

Move all files from multiple subfolders into the parent folder

I found a nice script at https://superuser.com/questions/999922/move-all-files-from-multiple-subfolders-into-the-parent-folder The main problem is I need a script which works for every subfolder...

Getting a better Voluptuous Schema error message for key type validation?

I have a Schema that looks like this (an example): Schema({ Any(str, unicode): [{ Required('first_name'): [Any(str, unicode)], Required('age'): Any('int32', 'double'), ...

Data Validation for Swagger

I'm trying to simplify endpoint data validation for a flask application, with a Swagger endpoint spec. I've avoided using the entire swagger-generated server code, because I find connexion too...

Voluptuous: Validate dicts within dicts

I'd like to validate the following YAML file defines a defaultdict that contains two dicts named dev and sha. !!python/object/apply:collections.defaultdict args: - !!python/name:builtins.dict...

Build Python Voluptuous Schema within another Schema

I am attempting to validate a schema within another schema. The error I receive with the following schema is "expected a dictionary" for the campaign parameter. The reason why I am trying to do...

Failed building wheel for xmlsec - mac

I'm installing my mac on python virtualenv environment. Whenever I install requirement packages command "pip install -r requirements.txt" i got this messages. pip install -r requirements.txt...