Skip to main content

A package to process data from Wikimedia using the server sent events (SSE) protocol.

Project description

Welcome to StatSpEdia

A tool written in Python 3.13 utilizing the async aiohttp package to grab and process data from Wikimedia using the server sent events (SSE) protocol.

Installation

To install a local copy please run: pip install statspedia

Example Usage

Create an Instance of the WikiStream Class

from statspedia import WikiStream
import asyncio

async def main():
    ws = WikiStream()
    return await ws.stream()
    
asyncio.run(main())

Program Console Output

There are 34 items in the list.
Wiki Edit List Size: 0.04 MB
Bytes Added: 1775
Bytes Removed: 669
Total Bytes Change: 1106
Top 10 Editors: 
{
    "BD2412": 4,
    "Panamitsu": 4,
    "Bearian": 1,
    "Altenmann": 1,
    "PCN02WPS": 1,
    "CarlTheCoincleaner": 1,
    "Madhon335": 1,
    "Bamboofirdaus": 1,
    "Xexerss": 1,
    "Youknowmyname657": 1
}

Top 10 Editors (Bots): 
{
    "GreenC bot": 8
}

Most Data Removed: 
{
    "bytes_removed": 403,
    "edit_data": {
        "$schema": "/mediawiki/recentchange/1.0.0",
        "meta": {
            "uri": "https://en.wikipedia.org/wiki/Basem_Abdo",
            "request_id": "6dc5cf9f-3641-45c7-8d71-7aba1ebfdef6",
            "id": "7edf7ae0-dad3-4a33-bc12-66779552448e",
            "dt": "2025-05-13T02:25:08Z",
            "domain": "en.wikipedia.org",
            "stream": "mediawiki.recentchange",
            "topic": "eqiad.mediawiki.recentchange",
            "partition": 0,
            "offset": 5582582578
        },
        "id": 1903433073,
        "type": "edit",
        "namespace": 0,
        "title": "Basem Abdo",
        "title_url": "https://en.wikipedia.org/wiki/Basem_Abdo",
        "comment": "'Deprod. Likely to be controversial. Please go to AfD.'",
        "timestamp": 1747103108,
        "user": "Bearian",
        "bot": false,
        "notify_url": "https://en.wikipedia.org/w/index.php?diff=1290144333&oldid=1290126553",
        "minor": false,
        "length": {
            "old": 5672,
            "new": 5269
        },
        "revision": {
            "old": 1290126553,
            "new": 1290144333
        },
        "server_url": "https://en.wikipedia.org",
        "server_name": "en.wikipedia.org",
        "server_script_path": "/w",
        "wiki": "enwiki",
        "parsedcomment": "'Deprod. Likely to be controversial. Please go to AfD.'"
    }
}

Most Data Added: 
{
    "bytes_added": 758,
    "edit_data": {
        "$schema": "/mediawiki/recentchange/1.0.0",
        "meta": {
            "uri": "https://en.wikipedia.org/wiki/Church_of_the_Assumption_(Nashville,_Tennessee)",
            "request_id": "e60e4d1c-961b-4512-b35e-2167046f2a1c",
            "id": "eb1cf52f-78d5-4c98-9028-8edb5ae1db83",
            "dt": "2025-05-13T02:25:19Z",
            "domain": "en.wikipedia.org",
            "stream": "mediawiki.recentchange",
            "topic": "eqiad.mediawiki.recentchange",
            "partition": 0,
            "offset": 5582582788
        },
        "id": 1903433115,
        "type": "edit",
        "namespace": 0,
        "title": "Church of the Assumption (Nashville, Tennessee)",
        "title_url": "https://en.wikipedia.org/wiki/Church_of_the_Assumption_(Nashville,_Tennessee)",
        "comment": "'/* History of the Parish in the 20th Century */ 1906 renovation which installed current pews and floor, carnival lights, and other features of church today as well as removed/modified features'",
        "timestamp": 1747103119,
        "user": "Johnnygoesmarchinghome",
        "bot": false,
        "notify_url": "https://en.wikipedia.org/w/index.php?diff=1290144350&oldid=1290141507",
        "minor": false,
        "length": {
            "old": 27414,
            "new": 28172
        },
        "revision": {
            "old": 1290141507,
            "new": 1290144350
        },
        "server_url": "https://en.wikipedia.org",
        "server_name": "en.wikipedia.org",
        "server_script_path": "/w",
        "wiki": "enwiki",
        "parsedcomment": "'<span class=\\'autocomment\\'><a href=\\'/wiki/Church_of_the_Assumption_(Nashville,_Tennessee)#History_of_the_Parish_in_the_20th_Century\\' title=\\'Church of the Assumption (Nashville, Tennessee)\\'>→<bdi dir=\\'ltr\\'>History of the Parish in the 20th Century</bdi></a>: </span> 1906 renovation which installed current pews and floor, carnival lights, and other features of church today as well as removed/modified features'"
    }
}

Stopping the Program

The program may be safely stopped using ctrl + c which will cancel all active async tasks.

The following will be outputted to the console:

All tasks cancelled.
Elapsed Time: 0.0 days 0.0 hours 0.0 mins 18.9 secs

License

MIT

Project Status

In development.

Authors

John Glauber

Contact

For any questions, comments, or suggestions please reach out via email to:

John Glauber
johnbglauber@gmail.com

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

statspedia-0.0.3.tar.gz (8.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

statspedia-0.0.3-py3-none-any.whl (7.6 kB view details)

Uploaded Python 3

File details

Details for the file statspedia-0.0.3.tar.gz.

File metadata

  • Download URL: statspedia-0.0.3.tar.gz
  • Upload date:
  • Size: 8.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for statspedia-0.0.3.tar.gz
Algorithm Hash digest
SHA256 5532c1ff57e5298fc77b6170772e91f6abf6d90db0c0a62b1139aa83638f12fb
MD5 1ff35ae3d88efcde9a1def204063c856
BLAKE2b-256 2c83d0a2fc2d4fb0c1c0150154a4610ab8793476bf98cda4a2b008b32acf8dc0

See more details on using hashes here.

Provenance

The following attestation bundles were made for statspedia-0.0.3.tar.gz:

Publisher: publish-python-dist-pypi.yml on jglauber/wikipediastats

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file statspedia-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: statspedia-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 7.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for statspedia-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 55b3aee6b74adcf4ede84e3f8cfc4269cf72a6f02f82d493277821a1b72aecc3
MD5 09e2f6392c2e9d21c15c8b7ebe0cc72f
BLAKE2b-256 7915cddf172d1a139fb71fb4b0e7e8f1e6ea0ce9ba2cb37943a7d582159936fa

See more details on using hashes here.

Provenance

The following attestation bundles were made for statspedia-0.0.3-py3-none-any.whl:

Publisher: publish-python-dist-pypi.yml on jglauber/wikipediastats

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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