cocorum.jsonhandles
This module provides abstract classes for wrapping JSON data blocks returned by the API in a Python object with attributes / properties. This library does not contain any classes or functions meant to be used directly.
JSON handles
Abstract classes for handling JSON data.
Copyright 2026 Wilbur Jaywright d.b.a. Marswide BGL.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
S.D.G.
JSONObj
Abstract class for handling a JSON data block as an object
Source code in src/cocorum/jsonhandles.py
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | |
get
property
Get a key from the JSON with fallback
jsondata
property
A copy of the raw JSON from the API. Editing it does not change this object.
__getitem__(key)
Get a key from the JSON
Source code in src/cocorum/jsonhandles.py
40 41 42 | |
__init__(jsondata)
Abstract class for handling a JSON data block as an object.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
jsondata
|
dict
|
The JSON data block of an API object. |
required |
Source code in src/cocorum/jsonhandles.py
31 32 33 34 35 36 37 38 | |
JSONUserAction
Bases: JSONObj
Abstract class for Rumble JSON user actions
Source code in src/cocorum/jsonhandles.py
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 | |
profile_pic
property
The user's profile picture as a bytes string
profile_pic_url
property
The user's profile picture URL
username
property
The username
__eq__(other)
Is this user equal to another?
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
other
|
Any
|
Object to compare to. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
Comparison |
bool
|
Did it fit the criteria? |
Source code in src/cocorum/jsonhandles.py
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 | |
__init__(jsondata)
Abstract class for Rumble JSON user actions.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
jsondata
|
dict
|
The JSON block for a single Rumble user action. |
required |
Source code in src/cocorum/jsonhandles.py
58 59 60 61 62 63 64 65 66 | |
__repr__()
String to represent this object
Source code in src/cocorum/jsonhandles.py
101 102 103 | |
__str__()
Follower as a string
Source code in src/cocorum/jsonhandles.py
97 98 99 | |
S.D.G.