Skip to main content

It is a Flask extension to view incidents caused by the server

Project description

En español

FlaskStatus

It is a Flask extension to view incidents caused by the server.

Example Status

This is handled based on the requests that users make. Captures the server response and uses the conditional expression to quickly classify whether the request was successful or failed.

Note: Updates every minute

Codes HTTP

Some of the HTTP states that the server takes into account are:

  • 200 OK: Indicates that the request has been completed successfully.

  • 404 Not Found: Indicates that the requested resource is not available on the server.

  • 500 Internal Server Error: Indicates that an internal server error has occurred while processing the client request.

  • 502 Bad Gateway: Indicates that there is a communication error between servers, generally when one server acts as an intermediary and cannot obtain a valid response.

  • 503 Service Unavailable: Indicates that the server is currently unavailable, possibly due to maintenance or overload.

  • 504 Gateway Timeout: Indicates that the server has not received a timely response from an upstream server, which may indicate connectivity problems.

Install

pip install flask-server-status

Use

  • Import and configure FlaskStatus in your Flask application. You need a database to record the logs.
from flask import Flask
from flask_server_status import FlaskStatus

app = Flask(__name__)
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///tmp/status.db'
FlaskStatus(app)

You can configure which routes you want to be shown:

FlaskStatus(app, routes=['/'])

The default path is: /status. Although you can configure the route.

FlaskStatus(app, url_prefix='/status')
  • Define routes. The use of docstring. It will be used to define the route name. # <ROUTE NAME>
@app.route('/')
def index():
    """
    # Index
    """ # This is the docstring
    return 'Welcome to API!', 200 # 200 is the status code

In case you have not defined the route name. By default, it will take the name of the endpoint role.

API

FlaskStatus comes with a built-in API to configure the routes that are generated in the database.

app.config['API_ENABLED'] = True
app.config['API_SECRET'] = 'tSx0L5exSjiPqqXs'

Endpoints

  • PUT /flask-status/configure: Allows you to modify a route. json={'rule': '/', 'name': 'Hello World!', 'doc': ''}

  • DELETE /flask-status/configure: Allows you to delete a route. json={'rule': '/'}

Example

import requests

r = requests.delete('http://127.0.0.1:5000/flask-status/configure', headers={
    'Authorization': 'Bearer tSx0L5exSjiPqqXs'
    }, json={
    'rule': '/'
})

Forked from

The page was built by Statsig's Open-Source Status Page.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

flask_server_status-0.0.4.tar.gz (49.3 kB view details)

Uploaded Source

Built Distribution

flask_server_status-0.0.4-py3-none-any.whl (48.9 kB view details)

Uploaded Python 3

File details

Details for the file flask_server_status-0.0.4.tar.gz.

File metadata

  • Download URL: flask_server_status-0.0.4.tar.gz
  • Upload date:
  • Size: 49.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.11.1 requests/2.32.3 setuptools/70.1.1 requests-toolbelt/1.0.0 tqdm/4.66.4 CPython/3.12.4

File hashes

Hashes for flask_server_status-0.0.4.tar.gz
Algorithm Hash digest
SHA256 3564f5fc017ff22a769527dab484ee8f89fc1694b186772a5eb4d04f2ec0a49c
MD5 6e5c24a288418df563341b69e8673bf9
BLAKE2b-256 d75c5c644460803370112e703c4c002b23f6f1171b302d6ce8385c1b486ba3a9

See more details on using hashes here.

File details

Details for the file flask_server_status-0.0.4-py3-none-any.whl.

File metadata

  • Download URL: flask_server_status-0.0.4-py3-none-any.whl
  • Upload date:
  • Size: 48.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.11.1 requests/2.32.3 setuptools/70.1.1 requests-toolbelt/1.0.0 tqdm/4.66.4 CPython/3.12.4

File hashes

Hashes for flask_server_status-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 263401bcf1a4cbea4424066e58c6c7f9a8ad546f936af3840ba5febd4febdbdb
MD5 9323caae33df60f7793446ff2e6a4368
BLAKE2b-256 a9ae62449e0e8d65632dd19929c090f865261f9341c9a29efa904878dfe66e86

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page