Skip to content

Commit

Permalink
script to generate latest api specs file (#1374)
Browse files Browse the repository at this point in the history
  • Loading branch information
jerryfletcher21 authored Sep 9, 2024
1 parent fbbccc1 commit d07c491
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions scripts/api-specs-update.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/usr/bin/env python3

"""Update the latest api specs file from a running django server"""

import sys

import urllib.request
import urllib.error


try:
urllib.request.urlretrieve(
"http://127.0.0.1:8000/api/schema", "docs/assets/schemas/api-latest.yaml"
)
except urllib.error.URLError as e:
print(f"Could not fetch latests API specs: {e}", file=sys.stderr)
print("Make sure that the django server is running", file=sys.stderr)
sys.exit(1)

print("Api specs successfully updated")

0 comments on commit d07c491

Please sign in to comment.