You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

15 lines
433 B

from flask import Blueprint, jsonify
import psutil
memory_bp = Blueprint('memory', __name__)
@memory_bp.route('/memory', methods=['GET'])
def get_memory():
virtual_memory = psutil.virtual_memory()
return jsonify({
'total': virtual_memory.total,
'available': virtual_memory.available,
'percent': virtual_memory.percent,
'used': virtual_memory.used,
'free': virtual_memory.free,
})