wagtail-metrics


Namewagtail-metrics JSON
Version 0.0.11 PyPI version JSON
download
home_pagehttps://github.com/Aleksi44/wagtail-metrics
SummaryWagtail Metrics
upload_time2023-07-10 15:34:50
maintainer
docs_urlNone
authorAlexis Le Baron
requires_python
licenseGPL-3.0
keywords wagtail metrics
VCS
bugtrack_url
requirements Django wagtail flake8 requests django-environ
Travis-CI No Travis.
coveralls test coverage No coveralls.
            ***************
Wagtail Metrics
***************

.. image:: https://img.shields.io/pypi/v/wagtail_metrics
    :target: https://pypi.org/project/wagtail_metrics/

.. image:: https://img.shields.io/pypi/pyversions/wagtail_metrics
    :target: https://pypi.org/project/wagtail_metrics/

Wagtail Metrics allows you to retrieve information about Wagtail pages.

Information providers for Wagtail pages are :

- **wagtail_page** : retrieves all fields and blocks
- **request** : get the HTTP status code of Wagtail pages
- **google_page_speed** : collects scores on performance, accessibility, best practices and SEO

Usage
#####

You can use Wagtail Metrics like this :

.. code-block:: python

    from wagtail.core.models import Site
    from wagtail_metrics.checkup import Checkup

    checkup = Checkup(providers=[
            'wagtail_page',
            'request',
            'google_page_speed'
    ])
    for site in Site.objects.all():
        checkup.add_site(site)
    checkup_json = checkup.to_json()

**checkup_json** is equal to :

.. code-block::

    {
        "stream_field__block__title": {
            "counter": 3,
            "values": {
                "generic title": {
                    "counter": 3,
                    "pages": [
                        "https://www.snoweb.io/fr/",
                        "https://www.snoweb.io/fr/cms/",
                        "https://www.snoweb.io/fr/cms/wagtail/"
                    ]
                }
            }
        },
        "stream_field__block__description": {
            "counter": 3,
            "values": {
                "different description 1": {
                    "counter": 1,
                    "pages": [
                        "https://www.snoweb.io/fr/"
                    ]
                },
                "different description 2": {
                    "counter": 1,
                    "pages": [
                        "https://www.snoweb.io/fr/cms/"
                    ]
                },
                "different description 3": {
                    "counter": 1,
                    "pages": [
                        "https://www.snoweb.io/fr/cms/wagtail/"
                    ]
                }
            }
        },
        "locale": {
            "counter": 3,
            "values": {
                "french": {
                    "counter": 3,
                    "pages": [
                        "https://www.snoweb.io/fr/",
                        "https://www.snoweb.io/fr/cms/",
                        "https://www.snoweb.io/fr/cms/wagtail/"
                    ]
                }
            }
        },
        "title": {
            "counter": 3,
            "values": {
                "Home": {
                    "counter": 1,
                    "pages": [
                        "https://www.snoweb.io/fr/"
                    ]
                },
                "CMS": {
                    "counter": 1,
                    "pages": [
                        "https://www.snoweb.io/fr/cms/"
                    ]
                },
                "Wagtail": {
                    "counter": 1,
                    "pages": [
                        "https://www.snoweb.io/fr/cms/wagtail/"
                    ]
                }
            }
        },
        "slug": {
            "counter": 3,
            "values": {
                "home": {
                    "counter": 1,
                    "pages": [
                        "https://www.snoweb.io/fr/"
                    ]
                },
                "cms": {
                    "counter": 1,
                    "pages": [
                        "https://www.snoweb.io/fr/cms/"
                    ]
                },
                "wagtail": {
                    "counter": 1,
                    "pages": [
                        "https://www.snoweb.io/fr/cms/wagtail/"
                    ]
                }
            }
        },
        "live": {
            "counter": 3,
            "values": {
                "true": {
                    "counter": 3,
                    "pages": [
                        "https://www.snoweb.io/fr/",
                        "https://www.snoweb.io/fr/cms/",
                        "https://www.snoweb.io/fr/cms/wagtail/"
                    ]
                }
            }
        },
        "owner": {
            "counter": 3,
            "values": {
                "none": {
                    "counter": 3,
                    "pages": [
                        "https://www.snoweb.io/fr/",
                        "https://www.snoweb.io/fr/cms/",
                        "https://www.snoweb.io/fr/cms/wagtail/"
                    ]
                }
            }
        },
        "seo_title": {
            "counter": 3,
            "values": {
                "": {
                    "counter": 3,
                    "pages": [
                        "https://www.snoweb.io/fr/",
                        "https://www.snoweb.io/fr/cms/",
                        "https://www.snoweb.io/fr/cms/wagtail/"
                    ]
                }
            }
        },
        "show_in_menus": {
            "counter": 3,
            "values": {
                "false": {
                    "counter": 3,
                    "pages": [
                        "https://www.snoweb.io/fr/",
                        "https://www.snoweb.io/fr/cms/",
                        "https://www.snoweb.io/fr/cms/wagtail/"
                    ]
                }
            }
        },
        "search_description": {
            "counter": 3,
            "values": {
                "": {
                    "counter": 3,
                    "pages": [
                        "https://www.snoweb.io/fr/",
                        "https://www.snoweb.io/fr/cms/",
                        "https://www.snoweb.io/fr/cms/wagtail/"
                    ]
                }
            }
        },
        "first_published_at": {
            "counter": 3,
            "values": {
                "none": {
                    "counter": 3,
                    "pages": [
                        "https://www.snoweb.io/fr/",
                        "https://www.snoweb.io/fr/cms/",
                        "https://www.snoweb.io/fr/cms/wagtail/"
                    ]
                }
            }
        },
        "last_published_at": {
            "counter": 3,
            "values": {
                "none": {
                    "counter": 3,
                    "pages": [
                        "https://www.snoweb.io/fr/",
                        "https://www.snoweb.io/fr/cms/",
                        "https://www.snoweb.io/fr/cms/wagtail/"
                    ]
                }
            }
        },
        "char_field": {
            "counter": 3,
            "values": {
                "Test char field": {
                    "counter": 3,
                    "pages": [
                        "https://www.snoweb.io/fr/",
                        "https://www.snoweb.io/fr/cms/",
                        "https://www.snoweb.io/fr/cms/wagtail/"
                    ]
                }
            }
        },
        "request__status_code": {
            "counter": 3,
            "values": {
                "200": {
                    "counter": 3,
                    "pages": [
                        "https://www.snoweb.io/fr/",
                        "https://www.snoweb.io/fr/cms/",
                        "https://www.snoweb.io/fr/cms/wagtail/"
                    ]
                }
            }
        },
        "google_page_speed__performance": {
            "counter": 3,
            "values": {
                "99": {
                    "counter": 1,
                    "pages": [
                        "https://www.snoweb.io/fr/"
                    ]
                },
                "84": {
                    "counter": 1,
                    "pages": [
                        "https://www.snoweb.io/fr/cms/"
                    ]
                },
                "75": {
                    "counter": 1,
                    "pages": [
                        "https://www.snoweb.io/fr/cms/wagtail/"
                    ]
                }
            }
        },
        "google_page_speed__accessibility": {
            "counter": 3,
            "values": {
                "95": {
                    "counter": 3,
                    "pages": [
                        "https://www.snoweb.io/fr/",
                        "https://www.snoweb.io/fr/cms/",
                        "https://www.snoweb.io/fr/cms/wagtail/"
                    ]
                }
            }
        },
        "google_page_speed__best_practices": {
            "counter": 3,
            "values": {
                "100": {
                    "counter": 3,
                    "pages": [
                        "https://www.snoweb.io/fr/",
                        "https://www.snoweb.io/fr/cms/",
                        "https://www.snoweb.io/fr/cms/wagtail/"
                    ]
                }
            }
        },
        "google_page__speed_seo": {
            "counter": 3,
            "values": {
                "100": {
                    "counter": 3,
                    "pages": [
                        "https://www.snoweb.io/fr/",
                        "https://www.snoweb.io/fr/cms/",
                        "https://www.snoweb.io/fr/cms/wagtail/"
                    ]
                }
            }
        },
        "stream_field__block_never_used__title": {
            "counter": 0,
            "values": {}
        }
    }

Setup
#####

Install with pip :

.. code-block::

    pip install wagtail_metrics

Set if needed in Django settings :

.. code-block::

    # Default value
    WAGTAIL_METRICS_DEFAULT_EXCLUDE = [
        'sites_rooted_here',
        'aliases',
        'revisions',
        'group_permissions',
        'view_restrictions',
        'workflow_states',
        'wagtail_admin_comments',
        'subscribers',
        'id',
        'path',
        'depth',
        'numchild',
        'translation_key',
        'draft_title',
        'has_unpublished_changes',
        'url_path',
        'go_live_at',
        'expire_at',
        'expired',
        'locked',
        'locked_at',
        'locked_by',
        'latest_revision_created_at',
        'live_revision',
        'alias_of',
        'page_ptr',
        'index_entries',
        'content_type'
    ]
    WAGTAIL_METRICS_INDENT_JSON = 4
    # For Google page speed
    WAGTAIL_METRICS_GOOGLE_API_KEY = 'xxx'



            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/Aleksi44/wagtail-metrics",
    "name": "wagtail-metrics",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "wagtail metrics",
    "author": "Alexis Le Baron",
    "author_email": "hello@snoweb.io",
    "download_url": "https://files.pythonhosted.org/packages/82/31/b0701cd7a35930ab8b9707d39a249edc04d91f88dcb080f1cb73e8d7c215/wagtail_metrics-0.0.11.tar.gz",
    "platform": "linux",
    "description": "***************\nWagtail Metrics\n***************\n\n.. image:: https://img.shields.io/pypi/v/wagtail_metrics\n    :target: https://pypi.org/project/wagtail_metrics/\n\n.. image:: https://img.shields.io/pypi/pyversions/wagtail_metrics\n    :target: https://pypi.org/project/wagtail_metrics/\n\nWagtail Metrics allows you to retrieve information about Wagtail pages.\n\nInformation providers for Wagtail pages are :\n\n- **wagtail_page** : retrieves all fields and blocks\n- **request** : get the HTTP status code of Wagtail pages\n- **google_page_speed** : collects scores on performance, accessibility, best practices and SEO\n\nUsage\n#####\n\nYou can use Wagtail Metrics like this :\n\n.. code-block:: python\n\n    from wagtail.core.models import Site\n    from wagtail_metrics.checkup import Checkup\n\n    checkup = Checkup(providers=[\n            'wagtail_page',\n            'request',\n            'google_page_speed'\n    ])\n    for site in Site.objects.all():\n        checkup.add_site(site)\n    checkup_json = checkup.to_json()\n\n**checkup_json** is equal to :\n\n.. code-block::\n\n    {\n        \"stream_field__block__title\": {\n            \"counter\": 3,\n            \"values\": {\n                \"generic title\": {\n                    \"counter\": 3,\n                    \"pages\": [\n                        \"https://www.snoweb.io/fr/\",\n                        \"https://www.snoweb.io/fr/cms/\",\n                        \"https://www.snoweb.io/fr/cms/wagtail/\"\n                    ]\n                }\n            }\n        },\n        \"stream_field__block__description\": {\n            \"counter\": 3,\n            \"values\": {\n                \"different description 1\": {\n                    \"counter\": 1,\n                    \"pages\": [\n                        \"https://www.snoweb.io/fr/\"\n                    ]\n                },\n                \"different description 2\": {\n                    \"counter\": 1,\n                    \"pages\": [\n                        \"https://www.snoweb.io/fr/cms/\"\n                    ]\n                },\n                \"different description 3\": {\n                    \"counter\": 1,\n                    \"pages\": [\n                        \"https://www.snoweb.io/fr/cms/wagtail/\"\n                    ]\n                }\n            }\n        },\n        \"locale\": {\n            \"counter\": 3,\n            \"values\": {\n                \"french\": {\n                    \"counter\": 3,\n                    \"pages\": [\n                        \"https://www.snoweb.io/fr/\",\n                        \"https://www.snoweb.io/fr/cms/\",\n                        \"https://www.snoweb.io/fr/cms/wagtail/\"\n                    ]\n                }\n            }\n        },\n        \"title\": {\n            \"counter\": 3,\n            \"values\": {\n                \"Home\": {\n                    \"counter\": 1,\n                    \"pages\": [\n                        \"https://www.snoweb.io/fr/\"\n                    ]\n                },\n                \"CMS\": {\n                    \"counter\": 1,\n                    \"pages\": [\n                        \"https://www.snoweb.io/fr/cms/\"\n                    ]\n                },\n                \"Wagtail\": {\n                    \"counter\": 1,\n                    \"pages\": [\n                        \"https://www.snoweb.io/fr/cms/wagtail/\"\n                    ]\n                }\n            }\n        },\n        \"slug\": {\n            \"counter\": 3,\n            \"values\": {\n                \"home\": {\n                    \"counter\": 1,\n                    \"pages\": [\n                        \"https://www.snoweb.io/fr/\"\n                    ]\n                },\n                \"cms\": {\n                    \"counter\": 1,\n                    \"pages\": [\n                        \"https://www.snoweb.io/fr/cms/\"\n                    ]\n                },\n                \"wagtail\": {\n                    \"counter\": 1,\n                    \"pages\": [\n                        \"https://www.snoweb.io/fr/cms/wagtail/\"\n                    ]\n                }\n            }\n        },\n        \"live\": {\n            \"counter\": 3,\n            \"values\": {\n                \"true\": {\n                    \"counter\": 3,\n                    \"pages\": [\n                        \"https://www.snoweb.io/fr/\",\n                        \"https://www.snoweb.io/fr/cms/\",\n                        \"https://www.snoweb.io/fr/cms/wagtail/\"\n                    ]\n                }\n            }\n        },\n        \"owner\": {\n            \"counter\": 3,\n            \"values\": {\n                \"none\": {\n                    \"counter\": 3,\n                    \"pages\": [\n                        \"https://www.snoweb.io/fr/\",\n                        \"https://www.snoweb.io/fr/cms/\",\n                        \"https://www.snoweb.io/fr/cms/wagtail/\"\n                    ]\n                }\n            }\n        },\n        \"seo_title\": {\n            \"counter\": 3,\n            \"values\": {\n                \"\": {\n                    \"counter\": 3,\n                    \"pages\": [\n                        \"https://www.snoweb.io/fr/\",\n                        \"https://www.snoweb.io/fr/cms/\",\n                        \"https://www.snoweb.io/fr/cms/wagtail/\"\n                    ]\n                }\n            }\n        },\n        \"show_in_menus\": {\n            \"counter\": 3,\n            \"values\": {\n                \"false\": {\n                    \"counter\": 3,\n                    \"pages\": [\n                        \"https://www.snoweb.io/fr/\",\n                        \"https://www.snoweb.io/fr/cms/\",\n                        \"https://www.snoweb.io/fr/cms/wagtail/\"\n                    ]\n                }\n            }\n        },\n        \"search_description\": {\n            \"counter\": 3,\n            \"values\": {\n                \"\": {\n                    \"counter\": 3,\n                    \"pages\": [\n                        \"https://www.snoweb.io/fr/\",\n                        \"https://www.snoweb.io/fr/cms/\",\n                        \"https://www.snoweb.io/fr/cms/wagtail/\"\n                    ]\n                }\n            }\n        },\n        \"first_published_at\": {\n            \"counter\": 3,\n            \"values\": {\n                \"none\": {\n                    \"counter\": 3,\n                    \"pages\": [\n                        \"https://www.snoweb.io/fr/\",\n                        \"https://www.snoweb.io/fr/cms/\",\n                        \"https://www.snoweb.io/fr/cms/wagtail/\"\n                    ]\n                }\n            }\n        },\n        \"last_published_at\": {\n            \"counter\": 3,\n            \"values\": {\n                \"none\": {\n                    \"counter\": 3,\n                    \"pages\": [\n                        \"https://www.snoweb.io/fr/\",\n                        \"https://www.snoweb.io/fr/cms/\",\n                        \"https://www.snoweb.io/fr/cms/wagtail/\"\n                    ]\n                }\n            }\n        },\n        \"char_field\": {\n            \"counter\": 3,\n            \"values\": {\n                \"Test char field\": {\n                    \"counter\": 3,\n                    \"pages\": [\n                        \"https://www.snoweb.io/fr/\",\n                        \"https://www.snoweb.io/fr/cms/\",\n                        \"https://www.snoweb.io/fr/cms/wagtail/\"\n                    ]\n                }\n            }\n        },\n        \"request__status_code\": {\n            \"counter\": 3,\n            \"values\": {\n                \"200\": {\n                    \"counter\": 3,\n                    \"pages\": [\n                        \"https://www.snoweb.io/fr/\",\n                        \"https://www.snoweb.io/fr/cms/\",\n                        \"https://www.snoweb.io/fr/cms/wagtail/\"\n                    ]\n                }\n            }\n        },\n        \"google_page_speed__performance\": {\n            \"counter\": 3,\n            \"values\": {\n                \"99\": {\n                    \"counter\": 1,\n                    \"pages\": [\n                        \"https://www.snoweb.io/fr/\"\n                    ]\n                },\n                \"84\": {\n                    \"counter\": 1,\n                    \"pages\": [\n                        \"https://www.snoweb.io/fr/cms/\"\n                    ]\n                },\n                \"75\": {\n                    \"counter\": 1,\n                    \"pages\": [\n                        \"https://www.snoweb.io/fr/cms/wagtail/\"\n                    ]\n                }\n            }\n        },\n        \"google_page_speed__accessibility\": {\n            \"counter\": 3,\n            \"values\": {\n                \"95\": {\n                    \"counter\": 3,\n                    \"pages\": [\n                        \"https://www.snoweb.io/fr/\",\n                        \"https://www.snoweb.io/fr/cms/\",\n                        \"https://www.snoweb.io/fr/cms/wagtail/\"\n                    ]\n                }\n            }\n        },\n        \"google_page_speed__best_practices\": {\n            \"counter\": 3,\n            \"values\": {\n                \"100\": {\n                    \"counter\": 3,\n                    \"pages\": [\n                        \"https://www.snoweb.io/fr/\",\n                        \"https://www.snoweb.io/fr/cms/\",\n                        \"https://www.snoweb.io/fr/cms/wagtail/\"\n                    ]\n                }\n            }\n        },\n        \"google_page__speed_seo\": {\n            \"counter\": 3,\n            \"values\": {\n                \"100\": {\n                    \"counter\": 3,\n                    \"pages\": [\n                        \"https://www.snoweb.io/fr/\",\n                        \"https://www.snoweb.io/fr/cms/\",\n                        \"https://www.snoweb.io/fr/cms/wagtail/\"\n                    ]\n                }\n            }\n        },\n        \"stream_field__block_never_used__title\": {\n            \"counter\": 0,\n            \"values\": {}\n        }\n    }\n\nSetup\n#####\n\nInstall with pip :\n\n.. code-block::\n\n    pip install wagtail_metrics\n\nSet if needed in Django settings :\n\n.. code-block::\n\n    # Default value\n    WAGTAIL_METRICS_DEFAULT_EXCLUDE = [\n        'sites_rooted_here',\n        'aliases',\n        'revisions',\n        'group_permissions',\n        'view_restrictions',\n        'workflow_states',\n        'wagtail_admin_comments',\n        'subscribers',\n        'id',\n        'path',\n        'depth',\n        'numchild',\n        'translation_key',\n        'draft_title',\n        'has_unpublished_changes',\n        'url_path',\n        'go_live_at',\n        'expire_at',\n        'expired',\n        'locked',\n        'locked_at',\n        'locked_by',\n        'latest_revision_created_at',\n        'live_revision',\n        'alias_of',\n        'page_ptr',\n        'index_entries',\n        'content_type'\n    ]\n    WAGTAIL_METRICS_INDENT_JSON = 4\n    # For Google page speed\n    WAGTAIL_METRICS_GOOGLE_API_KEY = 'xxx'\n\n\n",
    "bugtrack_url": null,
    "license": "GPL-3.0",
    "summary": "Wagtail Metrics",
    "version": "0.0.11",
    "project_urls": {
        "Homepage": "https://github.com/Aleksi44/wagtail-metrics"
    },
    "split_keywords": [
        "wagtail",
        "metrics"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "c76ae5ec9bd8edc776c5eb9f2defa1c92c92b693132cbe8498cef9bbb06e7930",
                "md5": "7a7c0e4e0e48551b1ca6aadc9abc74ec",
                "sha256": "e4287a93a8e3a588c1c76d664e661cf482882fa6a4e21c62af94a26eda5b1681"
            },
            "downloads": -1,
            "filename": "wagtail_metrics-0.0.11-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "7a7c0e4e0e48551b1ca6aadc9abc74ec",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 27666,
            "upload_time": "2023-07-10T15:34:48",
            "upload_time_iso_8601": "2023-07-10T15:34:48.519069Z",
            "url": "https://files.pythonhosted.org/packages/c7/6a/e5ec9bd8edc776c5eb9f2defa1c92c92b693132cbe8498cef9bbb06e7930/wagtail_metrics-0.0.11-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "8231b0701cd7a35930ab8b9707d39a249edc04d91f88dcb080f1cb73e8d7c215",
                "md5": "d8a46130c4257757af9b0efddb7600e2",
                "sha256": "3cddd8de10f5d3b883a916cafa7fa15e63b605d96909f61a79000df914d16db0"
            },
            "downloads": -1,
            "filename": "wagtail_metrics-0.0.11.tar.gz",
            "has_sig": false,
            "md5_digest": "d8a46130c4257757af9b0efddb7600e2",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 24606,
            "upload_time": "2023-07-10T15:34:50",
            "upload_time_iso_8601": "2023-07-10T15:34:50.399625Z",
            "url": "https://files.pythonhosted.org/packages/82/31/b0701cd7a35930ab8b9707d39a249edc04d91f88dcb080f1cb73e8d7c215/wagtail_metrics-0.0.11.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-07-10 15:34:50",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "Aleksi44",
    "github_project": "wagtail-metrics",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [
        {
            "name": "Django",
            "specs": [
                [
                    "==",
                    "4.0.2"
                ]
            ]
        },
        {
            "name": "wagtail",
            "specs": [
                [
                    "==",
                    "5.0.2"
                ]
            ]
        },
        {
            "name": "flake8",
            "specs": [
                [
                    "==",
                    "4.0.1"
                ]
            ]
        },
        {
            "name": "requests",
            "specs": [
                [
                    "==",
                    "2.27.1"
                ]
            ]
        },
        {
            "name": "django-environ",
            "specs": [
                [
                    "==",
                    "0.8.1"
                ]
            ]
        }
    ],
    "lcname": "wagtail-metrics"
}
        
Elapsed time: 0.69475s