python-clamav Could it get any simpler? Source

1---
2title: 'python-clamav Could it get any simpler?'
3date: '2007-05-04'
4published_at: '2007-05-04T10:59:00.000+10:00'
5tags: []
6author: 'Gavin Jackson'
7excerpt: 'If only life was this simple apt-get install python-clamav: >>> import pyclamav >>> ret=pyclamav.scanfile(''/tmp/virus'') >>> print ret (1, ''Worm.Sober.G'') >>> ret=pyclamav.scanthis("Buffer to test bla...'
8updated_at: '2007-05-04T11:02:04.030+10:00'
9legacy_url: 'http://www.gavinj.net/2007/05/python-clamav-could-it-get-any-simpler.html'
10---
11
12If only life was this simple apt-get install python-clamav:
13
14>>> import pyclamav >>> ret=pyclamav.scanfile('/tmp/virus') >>> print ret (1, 'Worm.Sober.G') >>> ret=pyclamav.scanthis("Buffer to test blalblabla...") >>> print ret (0, '') >>> print pyclamav.get_numsig() 25474
15
16Return value is a tupple (integer, string) where integer = 1: if a virus was found, string then contains the name of the virus = 0: no virus found, string is empty If anything went wrong, an exception ValueError is raised. String contains the error string (see clamav.h )
17
18
19