Commits

Paul McLanahan committed 1abb871

Added some metadata to the py file.
Shuffled some code around.

Comments (0)

Files changed (1)

 from pyactiveresource.activeresource import ActiveResource
 
 
+VERSION = (0, 1, 0)
+
+__version__ = '.'.join(map(str, VERSION))
+__author__ = 'Paul McLanahan'
+__contact__ = 'paul@mclanahan.net'
+__homepage__ = 'http://bitbucket.org/pmclanahan/slicehost-dynamic-dns'
+__license__ = 'BSD (3 clause)'
+
+__all__ = ['Slicehost']
 BASE_URL = 'https://%s@api.slicehost.com/'
 LOG_FILE = '/var/log/slicehost_ddns.log'
 CONFIG_FILE = os.environ.get('SLICEHOST_CONFIG', '/etc/slicehost_ddns.conf')
-logging.basicConfig(filename=LOG_FILE,
-                    level=logging.INFO,
-                    format='%(asctime)s %(levelname)s %(message)s')
 
 
 class Zone(ActiveResource):
             return False
         return zone.set_ip_for_records(ip_address, names, record_type)
 
-if __name__ == '__main__':
+def main(cfg_file=CONFIG_FILE):
+    logging.basicConfig(filename=LOG_FILE,
+                        level=logging.INFO,
+                        format='%(asctime)s %(levelname)s %(message)s')
 
     def print_result(message='success'):
         print "ContentType: text/plain\n"
         print_result('no config file')
     
     config = RawConfigParser({'names':None})
-    config.read(CONFIG_FILE)
+    config.read(cfg_file)
     qs = os.environ.get('QUERY_STRING')
     if qs:
         data = urlparse.parse_qs(qs)
             print_result()
     
     print_result('error')
+
+if __name__ == '__main__':
+    main()