cocorum


Namecocorum JSON
Version 0.2.0 PyPI version JSON
download
home_pageNone
SummaryAn unofficial Python wrapper for the Rumble Live Stream API v1.0 (beta)
upload_time2024-04-19 23:16:06
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.
            # Cocorum: Rumble Live Stream API Python Wrapper
A Python wrapper for the Rumble Live Stream API v1.0 (beta), with some quality of live 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 the help function should work. Note, you are only expected to create a RumbleAPI object, and work with everything through that.

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
from cocorum.localvars import *

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 != STREAM_VIS_PUBLIC:
        print("Stream is not public.")
    message = livestream.chat.latest_message #None if there are no messages yet
    if message:
        print(message.username, "said", message)
```

## Experimental SSE chat submodule
This part of cocorum is not part of the official Rumble Livestream API, but may provide a more reliable method of ensuring all chat messages are received.

```
from cocorum import ssechat

chat = ssechat.SSEChat(chat_id = CHAT_ID)
#Do chat.mailbox = [] here to erase messages that were still visible before we connected

msg = True
while msg:
    msg = chat.next_chat_message() #Hangs until a new message arrives
    print(msg.user.username, ":", msg)

print("Chat has closed.")
```

## 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/9a/b6/5288132dbe0014ab3df7d2dfbf0e3f93597e7987fe7f8f05e948455cdeb1/cocorum-0.2.0.tar.gz",
    "platform": null,
    "description": "# Cocorum: Rumble Live Stream API Python Wrapper\nA Python wrapper for the Rumble Live Stream API v1.0 (beta), with some quality of live additions, such as:\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 the help function should work. Note, you are only expected to create a RumbleAPI object, and work with everything through that.\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\nfrom cocorum.localvars import *\n\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 != STREAM_VIS_PUBLIC:\n        print(\"Stream is not public.\")\n    message = livestream.chat.latest_message #None if there are no messages yet\n    if message:\n        print(message.username, \"said\", message)\n```\n\n## Experimental SSE chat submodule\nThis part of cocorum is not part of the official Rumble Livestream API, but may provide a more reliable method of ensuring all chat messages are received.\n\n```\nfrom cocorum import ssechat\n\nchat = ssechat.SSEChat(chat_id = CHAT_ID)\n#Do chat.mailbox = [] here to erase messages that were still visible before we connected\n\nmsg = True\nwhile msg:\n    msg = chat.next_chat_message() #Hangs until a new message arrives\n    print(msg.user.username, \":\", msg)\n\nprint(\"Chat has closed.\")\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": "0.2.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": "e3382388fbf4e2319ac4bba5e8d3ad569c2883bb1486c7d46976147076481e12",
                "md5": "5068a6050f69dbcc74b3c82c8b966403",
                "sha256": "518f535e77d83a2657d6df32b6997c6f5a2d9d09485346ef4648e7ba2f859994"
            },
            "downloads": -1,
            "filename": "cocorum-0.2.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "5068a6050f69dbcc74b3c82c8b966403",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 22966,
            "upload_time": "2024-04-19T23:16:05",
            "upload_time_iso_8601": "2024-04-19T23:16:05.315882Z",
            "url": "https://files.pythonhosted.org/packages/e3/38/2388fbf4e2319ac4bba5e8d3ad569c2883bb1486c7d46976147076481e12/cocorum-0.2.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "9ab65288132dbe0014ab3df7d2dfbf0e3f93597e7987fe7f8f05e948455cdeb1",
                "md5": "ca490eabb968a75d1a6523d805e82f60",
                "sha256": "39a0ed39de1e81dccfee0a14e385810db9bb7c75545cc46c2ada38ab7165f6f2"
            },
            "downloads": -1,
            "filename": "cocorum-0.2.0.tar.gz",
            "has_sig": false,
            "md5_digest": "ca490eabb968a75d1a6523d805e82f60",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 21447,
            "upload_time": "2024-04-19T23:16:06",
            "upload_time_iso_8601": "2024-04-19T23:16:06.430144Z",
            "url": "https://files.pythonhosted.org/packages/9a/b6/5288132dbe0014ab3df7d2dfbf0e3f93597e7987fe7f8f05e948455cdeb1/cocorum-0.2.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-04-19 23:16:06",
    "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.33729s