X-Git-Url: https://jfr.im/git/z_archive/twitter.git/blobdiff_plain/907402f64301f9f87555afa5c305c40504da7145..ba02331e7304520b44ccd67d5ea64f574e62d2ba:/twitter/archiver.py diff --git a/twitter/archiver.py b/twitter/archiver.py index 5ceefd5..1984eaa 100644 --- a/twitter/archiver.py +++ b/twitter/archiver.py @@ -25,9 +25,17 @@ AUTHENTICATION from __future__ import print_function -import os, sys, time, calendar, urllib2, httplib, functools +import os, sys, time, calendar, functools from getopt import gnu_getopt as getopt, GetoptError +try: + import urllib.request as urllib2 + import http.client as httplib +except ImportError: + import urllib2 + import httplib + + # T-Archiver (Twitter-Archiver) application registered by @stalkr_ CONSUMER_KEY='d8hIyfzs7ievqeeZLjZrqQ' CONSUMER_SECRET='AnZmK0rnvaX7BoJ75l6XlilnbyMv7FoiDXWVmPD8' @@ -299,7 +307,7 @@ def main(args=sys.argv[1:]): tweets = {} try: tweets = load_tweets(filename) - except Exception, e: + except Exception as e: err("Error when loading saved tweets: %s - continuing without" % str(e)) @@ -328,7 +336,7 @@ def main(args=sys.argv[1:]): tweets = {} try: tweets = load_tweets(filename) - except Exception, e: + except Exception as e: err("Error when loading saved tweets: %s - continuing without" % str(e))