Skip to content

Commit

Permalink
Merge pull request #13 from dnedrow/urllib-header-fix
Browse files Browse the repository at this point in the history
Update translators.py to add user-agent header
  • Loading branch information
jfisbein authored Jan 16, 2025
2 parents 744992d + 045cad0 commit fd48321
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/jsonschema2ddl/translators.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,9 @@ def _validate_schema(self):
jsonschema.ValidationError: Schema is invalid
"""
metaschema_uri = self.schema.get("$schema", "https://json-schema.org/draft-07/schema")
metaschema_uri = urlopen(metaschema_uri).url
r = Request(metaschema_uri, headers={'User-Agent': 'Mozilla/5.0'})

meta_schema = json.loads(urlopen(metaschema_uri).read())
meta_schema = json.loads(urlopen(r).read())
jsonschema.validate(instance=self.schema, schema=meta_schema)
self.logger.debug("Schema is valid")

Expand Down

0 comments on commit fd48321

Please sign in to comment.