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 2025 Wilbur Jaywright.
This file is part of Cocorum.
Cocorum is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
Cocorum is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along with Cocorum. If not, see https://www.gnu.org/licenses/.
S.D.G.
JSONObj
Abstract class for handling a JSON data block as an object
Source code in cocorum/jsonhandles.py
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
|
get
property
Get a key from the JSON with fallback
__getitem__(key)
Get a key from the JSON
Source code in cocorum/jsonhandles.py
32 33 34 |
|
__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 cocorum/jsonhandles.py
23 24 25 26 27 28 29 30 |
|
JSONUserAction
Bases: JSONObj
Abstract class for Rumble JSON user actions
Source code in cocorum/jsonhandles.py
41 42 43 44 45 46 47 48 49 50 51 52 53 54 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 |
|
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
|
(str, JSONUserAction)
|
Object to compare to. |
required |
Returns:
Name | Type | Description |
---|---|---|
Comparison |
(bool, None)
|
Did it fit the criteria? |
Source code in cocorum/jsonhandles.py
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
|
__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 cocorum/jsonhandles.py
43 44 45 46 47 48 49 50 51 |
|
__str__()
Follower as a string
Source code in cocorum/jsonhandles.py
80 81 82 |
|
S.D.G.