--- a/script/lib/iri_tweet/export_twitter_alchemy.py Wed Jul 27 00:04:55 2011 +0200
+++ b/script/lib/iri_tweet/export_twitter_alchemy.py Mon Aug 08 09:01:40 2011 +0200
@@ -5,10 +5,9 @@
from optparse import OptionParser #@UnresolvedImport
from sqlalchemy import Table, Column, BigInteger, MetaData
from sqlalchemy.orm import sessionmaker
-from utils import parse_date, set_logging_options, set_logging, get_filter_query
+from utils import parse_date, set_logging_options, set_logging, get_filter_query, logger
from models import setup_database
import datetime
-import logging
import os.path
import re
import sys
@@ -101,7 +100,7 @@
set_logging(options)
- logging.debug("OPTIONS : " + repr(options)) #@UndefinedVariable
+ logger.debug("OPTIONS : " + repr(options)) #@UndefinedVariable
if len(sys.argv) == 1 or options.database is None:
parser.print_help()
@@ -159,7 +158,7 @@
for params in parameters:
- logging.debug("PARAMETERS " + repr(params)) #@UndefinedVariable
+ logger.debug("PARAMETERS " + repr(params)) #@UndefinedVariable
start_date_str = params.get("start_date",None)
end_date_str = params.get("end_date", None)
@@ -192,12 +191,12 @@
if content_file and content_file.find("http") == 0:
- logging.debug("url : " + content_file) #@UndefinedVariable
+ logger.debug("url : " + content_file) #@UndefinedVariable
h = httplib2.Http()
resp, content = h.request(content_file)
- logging.debug("url response " + repr(resp) + " content " + repr(content)) #@UndefinedVariable
+ logger.debug("url response " + repr(resp) + " content " + repr(content)) #@UndefinedVariable
project = anyjson.deserialize(content)
root = etree.fromstring(project["ldt"])
@@ -254,7 +253,7 @@
if ensemble_parent is None:
- logging.error("Can not process file") #@UndefinedVariable
+ logger.error("Can not process file") #@UndefinedVariable
sys.exit()
if options.replace:
@@ -309,18 +308,18 @@
project["ldt"] = output_data
body = anyjson.serialize(project)
- logging.debug("write http " + content_file) #@UndefinedVariable
- logging.debug("write http " + repr(body)) #@UndefinedVariable
+ logger.debug("write http " + content_file) #@UndefinedVariable
+ logger.debug("write http " + repr(body)) #@UndefinedVariable
h = httplib2.Http()
resp, content = h.request(content_file, "PUT", headers={'content-type':'application/json'}, body=body)
- logging.debug("write http " + repr(resp) + " content " + content) #@UndefinedVariable
+ logger.debug("write http " + repr(resp) + " content " + content) #@UndefinedVariable
else:
if content_file and os.path.exists(content_file):
dest_file_name = content_file
else:
dest_file_name = options.filename
- logging.debug("WRITE : " + dest_file_name) #@UndefinedVariable
+ logger.debug("WRITE : " + dest_file_name) #@UndefinedVariable
output = open(dest_file_name, "w")
output.write(output_data)
output.flush()