Skip to content

Instantly share code, notes, and snippets.

@peterbe
Created September 26, 2022 13:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save peterbe/a19f45b6fa72be44b42b029e0a072c31 to your computer and use it in GitHub Desktop.
Save peterbe/a19f45b6fa72be44b42b029e0a072c31 to your computer and use it in GitHub Desktop.
import requests
from collections import Counter
paths = []
with open('content/admin/guides.md') as f:
record = False
for line in f:
if line.startswith('includeGuides:'):
record = True
continue
if record:
if line.startswith(' - '):
paths.append(line.strip()[2:])
else:
break
from pprint import pprint
pprint(paths)
counter = Counter()
for uri in paths:
url = 'http://localhost:4000/en/enterprise-server@3.6' + uri
r = requests.get(url, allow_redirects=False)
print(r)
counter[r.status_code] += 1
for code, count in counter.most_common():
print(code, '\t', count, 'times')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment