Version¶
Resource¶
Methods¶
-
Version.__init__(manager, data)¶ Resource initializer.
- Parameters
manager – The manager this resource belongs to
data – The raw json data
-
Version.get(name) → Any¶ Safely obtain any attribute name for the resource
- Parameters
name (str) – Key name in json response
- Returns
Value from the raw json response. If the key doesn’t exist
Noneis returned.
Attributes¶
-
Version.attrs¶ The raw json response from the server
- Type
dict
-
Version.value¶ Version string from Cachet service
- Type
str
-
Version.on_latest¶ Are we on latest version? Requires beacon enabled on server.
- Type
bool
-
Version.latest¶ Obtains info dict about latest version. Requires beacon enabled on server.
Dict format is:
{ "tag_name": "v2.3.10", "prelease": false, "draft": false }
- Type
dict
Manager¶
Methods¶
-
VersionManager.__init__(http_client: cachetclient.httpclient.HttpClient)¶ Manager initializer.
- Parameters
http_client – The httpclient
-
VersionManager.get() → cachetclient.v1.version.Version¶ Get version info from the server
Example:
>> version = client.version.get() >> version.value v2.3.10
- Returns
Versioninstance
-
VersionManager.__call__() → cachetclient.v1.version.Version¶ Shortcut to
getExample:
>> version = client.version() >> version.value v2.3.10
-
VersionManager.instance_list_from_json(data: str) → List[cachetclient.base.Resource]¶ Creates a resource instance list from a json string.
This doesn’t hit any endpoints in cachet, but rather enables us to create a resource class instances from json data. This can be useful when caching data from cachet in memcache or databases.
- Parameters
data (str) – json string containing the instance data
- Returns
The resource class instance
- Return type
Resource
- Raises
ValueError – if json data do not deserialize into a list
-
VersionManager.instance_from_dict(data: dict) → cachetclient.base.Resource¶ Creates a resource instance from a dictionary.
This doesn’t hit any endpoints in cachet, but rather enables us to create a resource class instance from dictionary data. This can be useful when caching data from cachet in memcache or databases.
- Parameters
data (dict) – dictionary containing the instance data
- Returns
The resource class instance
- Return type
Resource
-
VersionManager.instance_from_json(data: str) → cachetclient.base.Resource¶ Creates a resource instance from a json string.
This doesn’t hit any endpoints in cachet, but rather enables us to create a resource class instance from json data. This can be useful when caching data from cachet in memcache or databases.
- Parameters
data (str) – json string containing the instance data
- Returns
The resource class instance
- Return type
Resource