flask-server-status


Nameflask-server-status JSON
Version 0.0.4 PyPI version JSON
download
home_pagehttps://github.com/fcoagz/flask-status/
SummaryIt is a Flask extension to view incidents caused by the server
upload_time2024-09-23 02:44:26
maintainerNone
docs_urlNone
authorFrancisco Griman
requires_pythonNone
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            [En espaƱol](https://github.com/fcoagz/statuspage/blob/main/README_ES.md)

# FlaskStatus

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

![Example Status](https://github.com/fcoagz/statuspage/blob/main/assets/dashboard.png?raw=true)

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

```sh
pip install flask-server-status
```

## Use

- Import and configure FlaskStatus in your Flask application. You need a database to record the logs.

```py
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:

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

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

```py
FlaskStatus(app, url_prefix='/status')
```

- Define routes. The use of docstring. It will be used to define the route name. `# <ROUTE NAME>`

```py
@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

```py
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.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/fcoagz/flask-status/",
    "name": "flask-server-status",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": null,
    "author": "Francisco Griman",
    "author_email": "grihardware@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/d7/5c/5c644460803370112e703c4c002b23f6f1171b302d6ce8385c1b486ba3a9/flask_server_status-0.0.4.tar.gz",
    "platform": "any",
    "description": "[En espa\u00f1ol](https://github.com/fcoagz/statuspage/blob/main/README_ES.md)\r\n\r\n# FlaskStatus\r\n\r\nIt is a Flask extension to view incidents caused by the server.\r\n\r\n![Example Status](https://github.com/fcoagz/statuspage/blob/main/assets/dashboard.png?raw=true)\r\n\r\nThis 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.\r\n\r\n**Note**: Updates every minute\r\n\r\n## Codes HTTP\r\n\r\nSome of the HTTP states that the server takes into account are:\r\n\r\n- `200 OK`: Indicates that the request has been completed successfully.\r\n\r\n- `404 Not Found`: Indicates that the requested resource is not available on the server.\r\n\r\n- `500 Internal Server Error`: Indicates that an internal server error has occurred while processing the client request.\r\n\r\n- `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.\r\n\r\n- `503 Service Unavailable:` Indicates that the server is currently unavailable, possibly due to maintenance or overload.\r\n\r\n- `504 Gateway Timeout`: Indicates that the server has not received a timely response from an upstream server, which may indicate connectivity problems.\r\n\r\n## Install\r\n\r\n```sh\r\npip install flask-server-status\r\n```\r\n\r\n## Use\r\n\r\n- Import and configure FlaskStatus in your Flask application. You need a database to record the logs.\r\n\r\n```py\r\nfrom flask import Flask\r\nfrom flask_server_status import FlaskStatus\r\n\r\napp = Flask(__name__)\r\napp.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///tmp/status.db'\r\nFlaskStatus(app)\r\n```\r\n\r\nYou can configure which routes you want to be shown:\r\n\r\n```py\r\nFlaskStatus(app, routes=['/'])\r\n```\r\n\r\nThe default path is: `/status`. Although you can configure the route.\r\n\r\n```py\r\nFlaskStatus(app, url_prefix='/status')\r\n```\r\n\r\n- Define routes. The use of docstring. It will be used to define the route name. `# <ROUTE NAME>`\r\n\r\n```py\r\n@app.route('/')\r\ndef index():\r\n    \"\"\"\r\n    # Index\r\n    \"\"\" # This is the docstring\r\n    return 'Welcome to API!', 200 # 200 is the status code\r\n```\r\n\r\nIn case you have not defined the route name. By default, it will take the name of the endpoint role.\r\n\r\n## API\r\n\r\nFlaskStatus comes with a built-in API to configure the routes that are generated in the database.\r\n\r\n```\r\napp.config['API_ENABLED'] = True\r\napp.config['API_SECRET'] = 'tSx0L5exSjiPqqXs'\r\n```\r\n\r\n### Endpoints\r\n\r\n- `PUT /flask-status/configure`: Allows you to modify a route. `json={'rule': '/', 'name': 'Hello World!', 'doc': ''}`\r\n\r\n- `DELETE /flask-status/configure`: Allows you to delete a route. `json={'rule': '/'}`\r\n\r\n### Example\r\n\r\n```py\r\nimport requests\r\n\r\nr = requests.delete('http://127.0.0.1:5000/flask-status/configure', headers={\r\n    'Authorization': 'Bearer tSx0L5exSjiPqqXs'\r\n    }, json={\r\n    'rule': '/'\r\n})\r\n```\r\n\r\n## Forked from \r\n\r\nThe page was built by Statsig's Open-Source Status Page.\r\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "It is a Flask extension to view incidents caused by the server",
    "version": "0.0.4",
    "project_urls": {
        "Homepage": "https://github.com/fcoagz/flask-status/"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "a9ae62449e0e8d65632dd19929c090f865261f9341c9a29efa904878dfe66e86",
                "md5": "9323caae33df60f7793446ff2e6a4368",
                "sha256": "263401bcf1a4cbea4424066e58c6c7f9a8ad546f936af3840ba5febd4febdbdb"
            },
            "downloads": -1,
            "filename": "flask_server_status-0.0.4-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "9323caae33df60f7793446ff2e6a4368",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 48866,
            "upload_time": "2024-09-23T02:44:24",
            "upload_time_iso_8601": "2024-09-23T02:44:24.122756Z",
            "url": "https://files.pythonhosted.org/packages/a9/ae/62449e0e8d65632dd19929c090f865261f9341c9a29efa904878dfe66e86/flask_server_status-0.0.4-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d75c5c644460803370112e703c4c002b23f6f1171b302d6ce8385c1b486ba3a9",
                "md5": "6e5c24a288418df563341b69e8673bf9",
                "sha256": "3564f5fc017ff22a769527dab484ee8f89fc1694b186772a5eb4d04f2ec0a49c"
            },
            "downloads": -1,
            "filename": "flask_server_status-0.0.4.tar.gz",
            "has_sig": false,
            "md5_digest": "6e5c24a288418df563341b69e8673bf9",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 49324,
            "upload_time": "2024-09-23T02:44:26",
            "upload_time_iso_8601": "2024-09-23T02:44:26.126444Z",
            "url": "https://files.pythonhosted.org/packages/d7/5c/5c644460803370112e703c4c002b23f6f1171b302d6ce8385c1b486ba3a9/flask_server_status-0.0.4.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-09-23 02:44:26",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "fcoagz",
    "github_project": "flask-status",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "flask-server-status"
}
        
Elapsed time: 0.67274s