Object
VT module.
- class vt.Object(obj_type: str, obj_id: str | None = None, obj_attributes: Dict | None = None)[source]
This class encapsulates any type of object in the VirusTotal API.
Instances of this class are usually obtained from calls to
vt.Client.get_object(), however, you need to instantiante this class yourself for creating new objects that will be sent to the backend in a call tovt.Client.post_object().Learn more about objects in the VirusTotal API in: https://docs.virustotal.com/reference/objects
- classmethod from_dict(obj_dict: Dict)[source]
Creates an object from its dictionary representation.
The dictionary representation of a VirusTotal API object has the following structure:
{ "type": <object type>, "id": <object id>, "links": { "self": "https://www.virustotal.com/api/v3/<collection name>/<obj id>" }, "attributes": { ... } }
At least type and id are required to be present in the dictionary, if not, an exception is raised.
- get(attr_name: str, default: Any | None = None) Any[source]
Returns an attribute by name.
If the attribute is not present in the object, it returns None or the value specified in the “default” argument.
- Parameters:
attr_name (str) – Name of the attribute.
default – An optional value that will be returned if the attribute is not present in the object.
- set_data(key: str, value: Any)[source]
Sets a field of the object’s data.