+
+if __name__ == '__main__':
+ # If the user passed us a 'stdin' argument, we'll go with that,
+ # otherwise we'll try for a url opener
+
+ parser = OptionParser()
+ parser.add_option('-s', '--stdin', action='store_true', dest='stdin',
+ default=False, help='Take a calendar from standard input')
+ parser.add_option('-o', '--output', dest='outfile', default='',
+ help='Specify output file (defaults to standard output)')
+
+ (options, args) = parser.parse_args()
+
+ if not options.stdin:
+ try:
+ import httplib2
+ urllib = False
+ except ImportError:
+ try:
+ import urllib
+ urllib = True
+ except ImportError:
+ sys.stderr.write('Failed to find a suitable http downloader\n')
+ raise
+