gawen / virustotal

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

Cannot pass Windows paths. urlparse will find a scheme and interpret as a URL #8

Open th3coop opened 10 years ago

th3coop commented 10 years ago

import urlparse path = "C:\Users\careyh\VT-scanner\tmpavg8j8\batch-0-IDE-8.5.3-83203.zip" urlparse.urlparse(path) ParseResult(scheme='c', netloc='', path='\Users\careyh\VT-scanner\tmpavg8j8\x 08atch-0-IDE-8.5.3-83203.zip', params='', query='', fragment='') url = "http://bugs.activestate.com/" urlparse.urlparse(url) ParseResult(scheme='http', netloc='bugs.activestate.com', path='/', params='', q uery='', fragment='')

Based on that, switching to netloc seemed safe. Checked on Ubuntu 13.10:

import urlparse import os urlparse.urlparse(os.getcwd()) ParseResult(scheme='', netloc='', path='/home/qatest/virustotal', params='', query='', fragment='')