File tree Expand file tree Collapse file tree 1 file changed +23
-3
lines changed Expand file tree Collapse file tree 1 file changed +23
-3
lines changed Original file line number Diff line number Diff line change 1
1
import yaml
2
2
import argparse
3
+ import urllib .request
4
+ import xmltodict
5
+
3
6
4
7
def main (args ):
5
8
9
+ with urllib .request .urlopen ('http://developer.devrev.ai/sitemap.xml' ) as f :
10
+ xml_data = f .read ().decode ('utf-8' )
11
+
6
12
if args .beta :
7
- spec_src = './fern/apis/beta/openapi-beta.yaml'
13
+ version = 'beta'
14
+ elif args .public :
15
+ version = 'public'
16
+
17
+ data_dict = xmltodict .parse (xml_data )
18
+ urls = []
19
+ for i in data_dict ['urlset' ]['url' ]:
20
+ loc = i ['loc' ].replace ('https://developer.devrev.ai' , '' )
21
+ if '/api-reference' in loc and loc .startswith (f"/{ version } " ):
22
+ path = loc .split ('/' )
23
+ link = f"- [{ path [- 2 ]} > { path [- 1 ]} ]({ loc } )"
24
+ print (link )
25
+
26
+
27
+ #get_specs(version)
8
28
9
- get_specs (spec_src )
29
+ def get_specs (version ):
10
30
11
- def get_specs ( src ):
31
+ src = f"./fern/apis/ { version } /openapi-beta.yaml"
12
32
13
33
with open (src , 'r' ) as s :
14
34
spec = yaml .safe_load (s )
You can’t perform that action at this time.
0 commit comments