By the way, I wrote an article on Qiita for the first time.
MacBook Pro macOS Catalina 10.15.7
I have installed the following.
Because an error occurred when installing the library or using Jupiter, For the time being, I commented out to leave the user as root.
Use PyYAML library and CSV library. It's very easy and wonderful because you just write it in requirements.txt and rebuild And Rerun.
flask pyyaml csv ipykernel
Open yaml, Collect the contents you want to write to CSV in order, Save as CSV accomplished.
Since yaml is read as a dictionary type, The point was to describe the loop and variable acquisition so that they would meet the desired conditions.
import yaml import csv #Store the contents of yaml file in dictionary type variable with open("oidc-swagger.yaml", "r") as yf: data = yaml.safe_load(yf) #Extract necessary information from the dictionary and store it as an array api_list_array =  i = 0 api_list_array.append(["#", "operationId", "METHOD", "PATH"]) for path in data['paths'].keys(): if path != "/swagger": for verb in data['paths'][path].keys(): # if 'operationId' in data['paths'][path][verb]: name = data['paths'][path][verb]['operationId'] i = i+1 # print(i,name, verb, path) api_list_array.append([i, name, verb, path]) #Save the array as CSV with open('list.csv', 'w') as csvfile: writer = csv.writer(csvfile) writer.writerows(api_list_array)
This was my first post. I had a hard time building the environment, so I'll add a little more.