forked from Ketouem/flask-boto3
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexample.py
39 lines (24 loc) · 751 Bytes
/
example.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
from flask import Flask, jsonify
from flask_botox import Boto3
class Config:
DEBUG = True
BOTOX_SERVICES = ["s3", "ses"]
app = Flask(__name__)
app.config.from_object(Config)
boto_flask = Boto3(app)
@app.route("/connections")
def connections():
return jsonify({k: str(v) for k, v in boto_flask.connections.items()})
@app.route("/clients")
def clients():
return jsonify({k: str(v) for k, v in boto_flask.clients.items()})
@app.route("/resources")
def resources():
return jsonify({k: str(v) for k, v in boto_flask.resources.items()})
@app.route("/buckets")
def buckets():
return jsonify(
{"buckets": [b.name for b in boto_flask.resources["s3"].buckets.all()]}
)
if __name__ == "__main__":
app.run()