Closed jxb5151 closed 1 year ago
The "/intelligence/hunting_rulesets" endpoint doesn't return a single object, it returns multiple objects, therefore you must use an iterator. See: https://virustotal.github.io/vt-py/api/iterator.html
The get_object
method is expected to be used with endpoints that return a single object. This may be useful for understanding the difference between an object and a collection: https://developers.virustotal.com/reference/key-concepts
Thank you @plusvic ! Indeed, an iterator is exactly what I needed. Very quick and dirty example in case anyone else stumbles across this with the same issue (ensure a previously uploaded set of rulesets is enabled).
...
results = client.iterator(url)
async for rObj in results:
rObj.enabled = True
await client.patch_object_async(path=f'/intelligence/hunting_rulesets/{rObj.id}', obj=rObj)
Greetings!
When attempting to get a client object using these methods I receive the following error back:
While taking a closer look at the client.py file, it seems to be induced from the code here: https://github.com/VirusTotal/vt-py/blob/023c2e1b8609be997571ff8f83942e3821615bc0/vt/client.py#L265C5-L265C5
Was able to reproduce with the following:
I am trying to put together some code that will sync differences between a YARA rule file and the current LiveHunt ruleset, any suggestions on a workaround and or solution here is greatly appreciated!
Thanks, Jason