We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 17fb9cb commit aa6cf9eCopy full SHA for aa6cf9e
jsonschema/_format.py
@@ -218,6 +218,20 @@ def is_host_name(instance):
218
return True
219
220
221
+try:
222
+ # The built-in `idna` codec only implements RFC 3890, so we go elsewhere.
223
+ import idna
224
+except ImportError:
225
+ pass
226
+else:
227
+ @_checks_drafts(draft7="idn-hostname", raises=idna.IDNAError)
228
+ def is_idn_host_name(instance):
229
+ if not isinstance(instance, str_types):
230
+ return True
231
+ idna.encode(instance)
232
233
+
234
235
try:
236
import rfc3987
237
except ImportError:
setup.cfg
@@ -33,6 +33,7 @@ install_requires =
33
34
[options.extras_require]
35
format =
36
+ idna
37
jsonpointer>1.13
38
rfc3987
39
strict-rfc3339
0 commit comments