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. S.D.G.
JSONObj
Abstract class for handling a JSON data block as an object
Source code in cocorum/jsonhandles.py
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
|
get
property
Get a key from the JSON with fallback
__getitem__(key)
Get a key from the JSON
Source code in cocorum/jsonhandles.py
21 22 23 |
|
__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
12 13 14 15 16 17 18 19 |
|
JSONUserAction
Bases: JSONObj
Abstract class for Rumble JSON user actions
Source code in cocorum/jsonhandles.py
30 31 32 33 34 35 36 37 38 39 40 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 |
|
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
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 |
|
__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
32 33 34 35 36 37 38 39 40 |
|
__str__()
Follower as a string
Source code in cocorum/jsonhandles.py
69 70 71 |
|
S.D.G.