Skip to content

Commit c7025ea

Browse files
script to generate latest api specs file
1 parent e9a49d3 commit c7025ea

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

scripts/api-specs-update.py

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/usr/bin/env python3
2+
3+
"""Update the latest api specs file from a running django server"""
4+
5+
import sys
6+
7+
import urllib.request
8+
import urllib.error
9+
10+
11+
try:
12+
urllib.request.urlretrieve(
13+
"http://127.0.0.1:8000/api/schema", "docs/assets/schemas/api-latest.yaml"
14+
)
15+
except urllib.error.URLError as e:
16+
print(f"Could not fetch latests API specs: {e}", file=sys.stderr)
17+
print("Make sure that the django server is running", file=sys.stderr)
18+
sys.exit(1)
19+
20+
print("Api specs successfully updated")

0 commit comments

Comments
 (0)