#! /usr/bin/env python
#
# Copyright (C) 2000 phd2@email.com. All rights reserved.
#

__version__ = "$Revision: 1.5 $"[11:-2]

username = "admin"
password = "PASSWORD" # this is only example, of course ;)
zope = "http://htk.tpu.ee/"

import sys, urllib

class NoGUI_URLopener(urllib.FancyURLopener):
   def __init__(self, username, password, *args):
       apply(urllib.FancyURLopener.__init__, (self,) + args)

       self.username = username
       self.password = password
       self.asked = 0

   def prompt_user_passwd(self, host, realm):
       if self.asked:
           raise "Unauthorised"
       else:
           self.asked = 1
           return self.username, self.password

try:
    days = sys.argv[1]
except:
    days = 7

if __name__ == '__main__':
    urllib._urlopener = NoGUI_URLopener(username, password)
    urllib.urlretrieve("%s/Control_Panel/Database/manage_pack?days:float=%s" % (zope, days))

# EOF

