+ if options['dms']:
+ if isinstance(auth, NoAuth):
+ err("You must be authenticated to save DMs.")
+ raise SystemExit(1)
+
+ filename = options['save-dir'] + os.sep + options['dms']
+ print("* Archiving own DMs in %s" % filename)
+
+ dms = {}
+ try:
+ dms = load_tweets(filename)
+ except Exception as e:
+ err("Error when loading saved DMs: %s - continuing without"
+ % str(e))
+
+ try:
+ statuses(twitter, "", dms, received_dms=True, isoformat=options['isoformat'])
+ statuses(twitter, "", dms, received_dms=False, isoformat=options['isoformat'])
+ except KeyboardInterrupt:
+ err()
+ err("Interrupted")
+ raise SystemExit(1)
+
+ save_tweets(filename, dms)
+ print("Total DMs sent and received: %i" % len(dms))
+
+