Skip to content

Instantly share code, notes, and snippets.

@Sadin
Created December 17, 2014 21:22
Show Gist options
  • Save Sadin/1970b15cef6616fd7196 to your computer and use it in GitHub Desktop.
Save Sadin/1970b15cef6616fd7196 to your computer and use it in GitHub Desktop.
from flask import Flask
from flask import render_template
from mcstatus import MinecraftServer
app = Flask(__name__)
@app.route('/')
def index():
return render_template("index.html")
@app.route('/mc/<arg1>')
def mc(arg1):
server = MinecraftServer.lookup(arg1)
status = server.status()
latency = server.ping()
query = server.query()
return "The server has {0} players and responded to the request in {1} ms | The server response time is {2} ms ".format(status.players.online, status.latency, latency)
if __name__ == '__main__':
app.run(host="0.0.0.0", port=int("80"), debug=True)
{% extends "layout.html" %}
{% block title %}SoT{% endblock %}
{% block content %}
<h1> Sages of Twilight</h1>
{% endblock %}
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title>{% block title %}{% endblock %}</title>
<link rel="stylesheet" href="{{ url_for('static', filename='css/style.css') }}" />
</head>
<body>
{% block content %}{% endblock %}
</body>
</html>
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title>SoT</title>
<link rel="stylesheet" href="/static/css/style.css" />
</head>
<body>
<h1> Sages of Twilight</h1>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment