json-schemas/get.py

12 lines
283 B
Python

import requests
import yaml
import json
with open('sources.yaml', 'r') as sfile:
sources = yaml.safe_load(sfile)
for source in sources:
schema = requests.get(source['source'])
with open(source['target'], 'w') as jfile:
json.dump(schema.json(), jfile, indent=2)