Browse Source

example dir

Guénaël Muller 3 years ago
parent
commit
8df60464a5
5 changed files with 13 additions and 12 deletions
  1. 0 0
      example/example.py
  2. 13 12
      example/example_a_bottle.py
  3. 0 0
      example/example_a_flask.py
  4. 0 0
      example/example_a_pyramid.py
  5. 0 0
      example/example_b.py

example.py → example/example.py View File


example_a_bottle.py → example/example_a_bottle.py View File

@@ -113,19 +113,20 @@ app = bottle.Bottle()
113 113
 controllers = Controllers()
114 114
 controllers.bind(app)
115 115
 
116
+hapic.set_context(hapic.ext.bottle.BottleContext(app))
116 117
 
117
-# time.sleep(1)
118
-# s = hapic.generate_doc(app)
119
-# ss = json.loads(json.dumps(s))
120
-# for path in ss['paths']:
121
-#     for method in ss['paths'][path]:
122
-#         for response_code in ss['paths'][path][method]['responses']:
123
-#             ss['paths'][path][method]['responses'][int(response_code)] = ss['paths'][path][method]['responses'][response_code]
124
-#             del ss['paths'][path][method]['responses'][int(response_code)]
125
-# print(yaml.dump(ss, default_flow_style=False))
126
-# time.sleep(1)
118
+time.sleep(1)
119
+s = hapic.generate_doc()
120
+ss = json.loads(json.dumps(s))
121
+for path in ss['paths']:
122
+    for method in ss['paths'][path]:
123
+        for response_code in ss['paths'][path][method]['responses']:
124
+            ss['paths'][path][method]['responses'][int(response_code)] = ss['paths'][path][method]['responses'][response_code]
125
+            del ss['paths'][path][method]['responses'][int(response_code)]
126
+print(yaml.dump(ss, default_flow_style=False))
127
+time.sleep(1)
127 128
 
128
-hapic.set_context(hapic.ext.bottle.BottleContext(app))
129
-print(json.dumps(hapic.generate_doc()))
129
+
130
+#print(json.dumps(hapic.generate_doc()))
130 131
 
131 132
 app.run(host='localhost', port=8080, debug=True)

example_a_flask.py → example/example_a_flask.py View File


example_a_pyramid.py → example/example_a_pyramid.py View File


example_b.py → example/example_b.py View File