gawen / virustotal

💊 VirusTotal Public API 2.0 client for Python 2.x
https://www.virustotal.com/
155 stars 61 forks source link

Issue with URLs #4

Open phasmainmachina opened 11 years ago

phasmainmachina commented 11 years ago

Hello,

When attempting to provide a URL, the module throws an exception that relates to your usage of with and a urllib2.urlopen instance. It appears this object does not support the implicit "exit()" that is invoked when using "with", and therefore bombs. Traceback:

Traceback (most recent call last):
  File "./a.py", line 7, in <module>
    report = v.get('https://secure.eicar.org/eicar.com.txt')
  File "/root/virustotal/virustotal.py", line 154, in get
    o = self._fileobj_to_fcontent(anything, filename)
  File "/root/virustotal/virustotal.py", line 140, in _fileobj_to_fcontent
    with fh as f:
AttributeError: addinfourl instance has no attribute '__exit__'