diff --git a/virustotal.py b/virustotal.py index 7a99e1d..49e551a 100644 --- a/virustotal.py +++ b/virustotal.py @@ -131,7 +131,7 @@ def _fileobj_to_fcontent(cls, anything, filename = None): # Is URL ? if urlparse.urlparse(anything).scheme: - fh = urllib2.urlopen(anything) + return ["url", anything] else: # it's file @@ -166,12 +166,16 @@ def get(self, anything, filename = None): }) self._limit_call_handler() - req = urllib2.urlopen(urllib2.Request( - "http://www.virustotal.com/vtapi/v2/file/report", - data, - )).read() - report = Report(req, self) + if o[0] == "url": + req = urllib2.Request( + "http://www.virustotal.com/vtapi/v2/url/report", data) + else: + req = urllib2.Request( + "http://www.virustotal.com/vtapi/v2/file/report", data) + + response = urllib2.urlopen(req).read() + report = Report(response, self) return report