Created
January 26, 2013 14:53
-
-
Save ihpd/4642802 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
import os | |
import validictory | |
irc_schema = { "type": "object", | |
"properties":{ | |
"config": { | |
"type": "object", | |
"properties": { | |
"protocol_plugin": { | |
"type": "string" | |
}, | |
"connection_protocol_type": { | |
"type": "string" | |
}, | |
"log_plugins": { | |
"type": "string", | |
}, | |
"nick": { | |
"type": "string", | |
}, | |
"host": { | |
"type": "string", | |
}, | |
"port": { | |
"type": "string", | |
}, | |
"channel": { | |
"type": "string", | |
}, | |
"reconn_attempts": { | |
"type": "string", | |
} | |
} | |
} | |
} | |
} | |
json_data = open('settings.set') | |
data = json.load(json_data) | |
try: | |
data2 = validictory.validate(data, irc_schema) | |
except ValueError, error: | |
print error |
Both the parameters are passed as string and not as int
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
port and reconn_attempts should be int, please define all properties as required