cocorum


Namecocorum JSON
Version 2.3.0 PyPI version JSON
download
home_pageNone
SummaryAn unofficial Python wrapper for the Rumble Live Stream API v1.0 (beta)
upload_time2024-12-19 15:34:09
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/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.

## Usage:
I tried to document the wrapper well, so help("cocorum") should work. Note, you are only expected to create a RumbleAPI() and / or ssechat.SSEChat() object, and work with everything through them.

Most 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
import time

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

print(api.username)
print(api.latest_follower)

if api.latest_subscriber:
    print(api.latest_subscriber, "subscribed for $" + str(api.latest_subscriber.amount_dollars))

#RumbleLivestream objects returned by RumbleAPI properties are deep: When queried, they will pull new information via their parent RumbleAPI object.
livestream = api.latest_livestream #None if there is no stream running

if livestream:
    if livestream.visibility != "public":
        print("Stream is not public.")

    #Get messages for one minute
    start_time = time.time()
    while time.time() - start_time < 60 and livestream.is_live:
        for message in livestream.chat.new_messages:
            print(message.username, "said", message)
        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

Example usage:
```
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/05/d9/d689f19f5146b2130a121b8c6ec503753fa9f4813b13dad61b39ef8b84c9/cocorum-2.3.0.tar.gz",
    "platform": null,
    "description": "<h1><img src=\"https://raw.githubusercontent.com/thelabcat/rumble-api-wrapper-py/main/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## Usage:\nI tried to document the wrapper well, so help(\"cocorum\") should work. Note, you are only expected to create a RumbleAPI() and / or ssechat.SSEChat() object, and work with everything through them.\n\nMost 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\nimport time\n\n#API_URL is either Rumble Live Stream API URL with key\napi = RumbleAPI(API_URL, refresh_rate = 10)\n\nprint(api.username)\nprint(api.latest_follower)\n\nif api.latest_subscriber:\n    print(api.latest_subscriber, \"subscribed for $\" + str(api.latest_subscriber.amount_dollars))\n\n#RumbleLivestream objects returned by RumbleAPI properties are deep: When queried, they will pull new information via their parent RumbleAPI object.\nlivestream = api.latest_livestream #None if there is no stream running\n\nif livestream:\n    if livestream.visibility != \"public\":\n        print(\"Stream is not public.\")\n\n    #Get messages for one minute\n    start_time = time.time()\n    while time.time() - start_time < 60 and livestream.is_live:\n        for message in livestream.chat.new_messages:\n            print(message.username, \"said\", message)\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\nExample usage:\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.3.0",
    "project_urls": {
        "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": "d11c57721a87c07645e8f4e96e899b7f0e2476fb3f263a08b6c0a02593b24277",
                "md5": "6b568ba92d49a2d96492fd1495a86b08",
                "sha256": "6786275b0090723066b89a6d2414add9093c30595545ed0278f4ca15b51f0b89"
            },
            "downloads": -1,
            "filename": "cocorum-2.3.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "6b568ba92d49a2d96492fd1495a86b08",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 40792,
            "upload_time": "2024-12-19T15:34:07",
            "upload_time_iso_8601": "2024-12-19T15:34:07.893727Z",
            "url": "https://files.pythonhosted.org/packages/d1/1c/57721a87c07645e8f4e96e899b7f0e2476fb3f263a08b6c0a02593b24277/cocorum-2.3.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "05d9d689f19f5146b2130a121b8c6ec503753fa9f4813b13dad61b39ef8b84c9",
                "md5": "17c67107a99426b5dbff718a2d972587",
                "sha256": "8291b9eeed79615972e251a695c83cad79cdb3d20e305eae56aa2717c55c952d"
            },
            "downloads": -1,
            "filename": "cocorum-2.3.0.tar.gz",
            "has_sig": false,
            "md5_digest": "17c67107a99426b5dbff718a2d972587",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 378369,
            "upload_time": "2024-12-19T15:34:09",
            "upload_time_iso_8601": "2024-12-19T15:34:09.945337Z",
            "url": "https://files.pythonhosted.org/packages/05/d9/d689f19f5146b2130a121b8c6ec503753fa9f4813b13dad61b39ef8b84c9/cocorum-2.3.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-12-19 15:34:09",
    "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.35553s