python - sleep while querying VirusTotal? -
i use virustotal api check hash values against virustotal database, virustotal public api limits requests 4 per minute. section of code compares list of hash values (hash_list) against database follows:
url = "https://www.virustotal.com/vtapi/v2/file/report" parameters = {"resource": hash_list, "apikey": "<api key here>"} data = urllib.urlencode(parameters) req = urllib2.request(url, data) response = urllib2.urlopen(req) json_out = response.read()
i need figure out how add wait or sleep function code checks 1 hash hash_list, waits 15 seconds, checks hash, until list complete. keep queries 4 per minute, can't figure out how add wait work properly.
import time /code/ time.sleep(15)
should work. add time.sleep()
snippet block cause delay.
Comments
Post a Comment