mirror of
https://github.com/ThunixdotNet/thunix_api.git
synced 2026-01-24 05:10:17 +00:00
Initial api commit
This commit is contained in:
40
thunix_api.py
Normal file
40
thunix_api.py
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
# thunix_api.py
|
||||||
|
import flask
|
||||||
|
|
||||||
|
from flask import Flask, request, jsonify
|
||||||
|
app = Flask(__name__)
|
||||||
|
|
||||||
|
# No endpoint selected
|
||||||
|
@app.route("/")
|
||||||
|
def home():
|
||||||
|
return "The Thunix API. Please see https://wiki.thunix.net/wiki/api for more information."
|
||||||
|
app.run()
|
||||||
|
|
||||||
|
# ip_info
|
||||||
|
@app.route("/ip_info")
|
||||||
|
def ip_info():
|
||||||
|
return "IP Info"
|
||||||
|
app.run()
|
||||||
|
|
||||||
|
# uptime
|
||||||
|
@app.route("/uptime")
|
||||||
|
def uptime():
|
||||||
|
return "Uptime"
|
||||||
|
app.run()
|
||||||
|
|
||||||
|
# teapot
|
||||||
|
@app.route("/teapot")
|
||||||
|
def teapot():
|
||||||
|
teapot = [
|
||||||
|
{
|
||||||
|
"tea" : "available",
|
||||||
|
"height" : "short",
|
||||||
|
"width" : "stout"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
return jsonify(teapot)
|
||||||
|
app.run()
|
||||||
|
|
||||||
|
# main loop
|
||||||
|
if __name__ == "__main__": # on running python app.py
|
||||||
|
app.run() # run the flask app
|
||||||
Reference in New Issue
Block a user