cocorum


Namecocorum JSON
Version 2.6.1 PyPI version JSON
download
home_pageNone
SummaryAn unofficial Python wrapper for the Rumble Live Stream API v1.0 (beta)
upload_time2025-01-19 02:59:03
maintainerNone
docs_urlNone
authorNone
requires_python>=3.8
licenseNone
keywords api livestream rumble wrapper
VCS
bugtrack_url
requirements requests sseclient
Travis-CI No Travis.
coveralls test coverage No coveralls.
            <h1><img src="https://raw.githubusercontent.com/thelabcat/rumble-api-wrapper-py/main/src/docs/assets/cocorum_icon.png" alt="" width="64"/> Cocorum: Rumble Live Stream API Python Wrapper</h1>

A Python wrapper for the Rumble Live Stream API v1.0 (beta), with some quality of life additions, such as:

- Automatic refresh when past the refresh_rate delay when querying any non_static property.
- All timespamps are parsed to seconds since Epoch, UTC timezone.
- Chat has new_messages and new_rants properties that return only messages and rants since the last time they were read.

## Installation:
You can find [this project on PyPi.org](https://pypi.org/project/cocorum/), and install it using any PyPi-compatible method (including Pip). Alternatively, you can view and download [the source code on GitHub](https://github.com/thelabcat/rumble-api-wrapper-py).

## Usage:

I recommend taking a gander at [the full documentation](https://thelabcat.github.io/rumble-api-wrapper-py/), but here's a basic intro:

For the most part, attributes that are not added features have the same name as the direct JSON counterparts, with the exception of adding prefixes to some things that have the same name in the JSON as Python builtin functions. For example, thing/id in JSON is thing.thing_id in this Python wrapper.

```
from cocorum import RumbleAPI

## API_URL is Rumble Live Stream API URL with key
api = RumbleAPI(API_URL, refresh_rate = 10)

print(api.username)
## Should display your Rumble username

print("Latest follower:", api.latest_follower)
## Should display your latest follower, or None if you have none.

if api.latest_subscriber:
    print(api.latest_subscriber, f"subscribed for ${api.latest_subscriber.amount_dollars}")
## Should display your latest subscriber if you have one.

livestream = api.latest_livestream # None if there is no stream running

if livestream:
    print(livestream.title)
    print("Stream visibility is", livestream.visibility)

    #We will use this later
    STREAM_ID = livestream.stream_id

    print("Stream ID is", STREAM_ID)
    
    import time # We'll need this Python builtin for delays and knowing when to stop 

    # Get messages for one minute
    start_time = time.time()

    # Continue as long as we haven't been going for a whole minute, and the livestream is still live
    while time.time() - start_time < 60 and livestream.is_live:
        # For each new message...
        for message in livestream.chat.new_messages:
            # Display it
            print(message.username, "said", message)

        # Wait a bit, just to keep the loop from maxxing a CPU core
        time.sleep(0.1)
```

## Experimental internal API submodules
This part of Cocorum is not part of the official Rumble Live Stream API. It includes the following submodules:
- chatapi
- servicephp
- uploadphp
- scraping
- utils (very rare cases)

Example usage of `cocorum.chatapi`:
```
from cocorum import chatapi

#Additionally pass username and password for to-chat interactions
chat = chatapi.ChatAPI(stream_id = STREAM_ID) #Stream ID can be base 10 or 36
chat.clear_mailbox() #Erase messages that were still visible before we connected

#Get messages for one minute
start_time = time.time()
while time.time() - start_time < 60 and (msg := chat.get_message()):
    print(msg.user.username, "said", msg)
```

## Conclusion
Hope this helps!

I, Wilbur Jaywright, and my brand, Marswide BGL, have no official association with Rumble Corp. beyond that of a normal user and/or channel on the Rumble Video platform. This wrapper is not officially endorsed by Rumble Corp. or its subsidiaries.

S.D.G.

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "cocorum",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "api, livestream, rumble, wrapper",
    "author": null,
    "author_email": "Wilbur Jaywright <zargulthewizard@outlook.com>",
    "download_url": "https://files.pythonhosted.org/packages/54/c6/747a7351c590b04d95d058fbcc64b0f10825b5668bdd41646ad825096ffb/cocorum-2.6.1.tar.gz",
    "platform": null,
    "description": "<h1><img src=\"https://raw.githubusercontent.com/thelabcat/rumble-api-wrapper-py/main/src/docs/assets/cocorum_icon.png\" alt=\"\" width=\"64\"/> Cocorum: Rumble Live Stream API Python Wrapper</h1>\n\nA Python wrapper for the Rumble Live Stream API v1.0 (beta), with some quality of life additions, such as:\n\n- Automatic refresh when past the refresh_rate delay when querying any non_static property.\n- All timespamps are parsed to seconds since Epoch, UTC timezone.\n- Chat has new_messages and new_rants properties that return only messages and rants since the last time they were read.\n\n## Installation:\nYou can find [this project on PyPi.org](https://pypi.org/project/cocorum/), and install it using any PyPi-compatible method (including Pip). Alternatively, you can view and download [the source code on GitHub](https://github.com/thelabcat/rumble-api-wrapper-py).\n\n## Usage:\n\nI recommend taking a gander at [the full documentation](https://thelabcat.github.io/rumble-api-wrapper-py/), but here's a basic intro:\n\nFor the most part, attributes that are not added features have the same name as the direct JSON counterparts, with the exception of adding prefixes to some things that have the same name in the JSON as Python builtin functions. For example, thing/id in JSON is thing.thing_id in this Python wrapper.\n\n```\nfrom cocorum import RumbleAPI\n\n## API_URL is Rumble Live Stream API URL with key\napi = RumbleAPI(API_URL, refresh_rate = 10)\n\nprint(api.username)\n## Should display your Rumble username\n\nprint(\"Latest follower:\", api.latest_follower)\n## Should display your latest follower, or None if you have none.\n\nif api.latest_subscriber:\n    print(api.latest_subscriber, f\"subscribed for ${api.latest_subscriber.amount_dollars}\")\n## Should display your latest subscriber if you have one.\n\nlivestream = api.latest_livestream # None if there is no stream running\n\nif livestream:\n    print(livestream.title)\n    print(\"Stream visibility is\", livestream.visibility)\n\n    #We will use this later\n    STREAM_ID = livestream.stream_id\n\n    print(\"Stream ID is\", STREAM_ID)\n    \n    import time # We'll need this Python builtin for delays and knowing when to stop \n\n    # Get messages for one minute\n    start_time = time.time()\n\n    # Continue as long as we haven't been going for a whole minute, and the livestream is still live\n    while time.time() - start_time < 60 and livestream.is_live:\n        # For each new message...\n        for message in livestream.chat.new_messages:\n            # Display it\n            print(message.username, \"said\", message)\n\n        # Wait a bit, just to keep the loop from maxxing a CPU core\n        time.sleep(0.1)\n```\n\n## Experimental internal API submodules\nThis part of Cocorum is not part of the official Rumble Live Stream API. It includes the following submodules:\n- chatapi\n- servicephp\n- uploadphp\n- scraping\n- utils (very rare cases)\n\nExample usage of `cocorum.chatapi`:\n```\nfrom cocorum import chatapi\n\n#Additionally pass username and password for to-chat interactions\nchat = chatapi.ChatAPI(stream_id = STREAM_ID) #Stream ID can be base 10 or 36\nchat.clear_mailbox() #Erase messages that were still visible before we connected\n\n#Get messages for one minute\nstart_time = time.time()\nwhile time.time() - start_time < 60 and (msg := chat.get_message()):\n    print(msg.user.username, \"said\", msg)\n```\n\n## Conclusion\nHope this helps!\n\nI, Wilbur Jaywright, and my brand, Marswide BGL, have no official association with Rumble Corp. beyond that of a normal user and/or channel on the Rumble Video platform. This wrapper is not officially endorsed by Rumble Corp. or its subsidiaries.\n\nS.D.G.\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "An unofficial Python wrapper for the Rumble Live Stream API v1.0 (beta)",
    "version": "2.6.1",
    "project_urls": {
        "Documentation": "https://thelabcat.github.io/rumble-api-wrapper-py/",
        "Homepage": "https://github.com/thelabcat/rumble-api-wrapper-py",
        "Issues": "https://github.com/thelabcat/rumble-api-wrapper-py/issues",
        "Rumble Live Stream API docs": "https://rumblefaq.groovehq.com/help/how-to-use-rumble-s-live-stream-api"
    },
    "split_keywords": [
        "api",
        " livestream",
        " rumble",
        " wrapper"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "a4671df25b85d68048b876d212ae6fee40080f1faab6c0df4607687e42fc3a6c",
                "md5": "a230388fbbc8f8f43b0e31b47a8eef7b",
                "sha256": "7df05e40fd146e19859e4c91253380565ed114017033fa61557954325b12fa64"
            },
            "downloads": -1,
            "filename": "cocorum-2.6.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "a230388fbbc8f8f43b0e31b47a8eef7b",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 47142,
            "upload_time": "2025-01-19T02:59:01",
            "upload_time_iso_8601": "2025-01-19T02:59:01.588478Z",
            "url": "https://files.pythonhosted.org/packages/a4/67/1df25b85d68048b876d212ae6fee40080f1faab6c0df4607687e42fc3a6c/cocorum-2.6.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "54c6747a7351c590b04d95d058fbcc64b0f10825b5668bdd41646ad825096ffb",
                "md5": "ae319fe6616007088e7a5cb93ab43154",
                "sha256": "3c38aa88e5d9653cbe9fc317f0836324891af114f503b53d762cfe55c16979e5"
            },
            "downloads": -1,
            "filename": "cocorum-2.6.1.tar.gz",
            "has_sig": false,
            "md5_digest": "ae319fe6616007088e7a5cb93ab43154",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 1434351,
            "upload_time": "2025-01-19T02:59:03",
            "upload_time_iso_8601": "2025-01-19T02:59:03.364049Z",
            "url": "https://files.pythonhosted.org/packages/54/c6/747a7351c590b04d95d058fbcc64b0f10825b5668bdd41646ad825096ffb/cocorum-2.6.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-01-19 02:59:03",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "thelabcat",
    "github_project": "rumble-api-wrapper-py",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [
        {
            "name": "requests",
            "specs": []
        },
        {
            "name": "sseclient",
            "specs": []
        }
    ],
    "lcname": "cocorum"
}
        
Elapsed time: 0.55886s