File tree 4 files changed +47
-4
lines changed
4 files changed +47
-4
lines changed Original file line number Diff line number Diff line change 25
25
26
26
# Vagrant artifacts
27
27
ubuntu- * -console.log
28
+
29
+ # Python
30
+ __pycache__ /
Original file line number Diff line number Diff line change
1
+ import os
2
+ import re
3
+
4
+ from settings import ENDPOINTS_DIR
5
+
6
+ DOCUMENTATION_DIR = os .path .join (os .path .dirname (__file__ ), "../source/includes" )
7
+
8
+ def get_all_endpoints ():
9
+ endpoints = []
10
+ for root , dirs , files in os .walk (ENDPOINTS_DIR ):
11
+ for file in files :
12
+ with open (os .path .join (root , file ), 'r' ) as f :
13
+ if re .search (r"public bool \$api_disabled = true;" , f .read ()):
14
+ continue
15
+
16
+ endpoints .append (root .split (ENDPOINTS_DIR )[1 ] + "/" + file [:- 4 ])
17
+
18
+ return endpoints
19
+
20
+ def get_all_documented_endpoints ():
21
+ endpoints = []
22
+
23
+ for file in os .listdir (DOCUMENTATION_DIR ):
24
+ file_cat = file [1 :- 3 ]
25
+ with open (os .path .join (DOCUMENTATION_DIR , file ), 'r' ) as f :
26
+ for line in f .readlines ():
27
+ match = re .match (r"curl https:\/\/api\.simplyprint\.io\/\{id\}(.*?)(\?| \\).*$" , line )
28
+
29
+ if not match :
30
+ continue
31
+
32
+ endpoints .append (match .group (1 ))
33
+
34
+ return endpoints
35
+
36
+ print (get_all_endpoints ())
37
+ print (get_all_documented_endpoints ())
38
+
39
+ print ()
40
+
41
+ print (set (get_all_endpoints ()) ^ set (get_all_documented_endpoints ()))
Original file line number Diff line number Diff line change 2
2
3
3
import os
4
4
import re
5
- import json
5
+ from settings import ENDPOINTS_DIR
6
6
7
- ENDPOINTS_DIR = "/home/dnorhoj/Documents/Work/Code/local-site-dev/api/Endpoints"
8
- #OUTPUT_DIR = "./_generated/"
9
- OUTPUT_DIR = "../source/includes/"
7
+ OUTPUT_DIR = "./output"
10
8
11
9
# Template
12
10
TEMPLATE = """
Original file line number Diff line number Diff line change
1
+ ENDPOINTS_DIR = "/home/dnorhoj/Documents/Work/Code/local-site-dev/api/Endpoints"
You can’t perform that action at this time.
0 commit comments