Files
jira/schemas/fetch-schemas.py
T
2016-08-08 00:10:04 -07:00

22 lines
567 B
Python
Executable File

#!/usr/bin/env python
from lxml import html
import requests
import json
page = requests.get('https://docs.atlassian.com/jira/REST/cloud')
tree = html.fromstring(page.content)
schemas = tree.xpath("//div[@class='representation-doc-block']//code/text()")
for schema in schemas:
try:
data = json.loads(schema)
if "title" in data:
title = data["title"].replace(" ", "")
print "Writing {}.json".format(title)
with open("{}.json".format(title), 'w') as f:
f.write(schema)
except:
True