Subversion Repositories SmartDukaan

Rev

Rev 18156 | Rev 18440 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 18156 Rev 18257
Line 38... Line 38...
38
ALPHABET_REVERSE = dict((c, i) for (i, c) in enumerate(ALPHABET))
38
ALPHABET_REVERSE = dict((c, i) for (i, c) in enumerate(ALPHABET))
39
BASE = len(ALPHABET)
39
BASE = len(ALPHABET)
40
SIGN_CHARACTER = '$'
40
SIGN_CHARACTER = '$'
41
 
41
 
42
con=None
42
con=None
-
 
43
conDtrData = None
43
headers = { 
44
headers = { 
44
            'User-agent':'Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.120 Safari/537.36',
45
            'User-agent':'Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.120 Safari/537.36',
45
            'Accept' : 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',      
46
            'Accept' : 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',      
46
            'Accept-Language' : 'en-US,en;q=0.8',                     
47
            'Accept-Language' : 'en-US,en;q=0.8',                     
47
            'Accept-Charset' : 'ISO-8859-1,utf-8;q=0.7,*;q=0.3',
48
            'Accept-Charset' : 'ISO-8859-1,utf-8;q=0.7,*;q=0.3',
Line 88... Line 89...
88
        except Exception, e:
89
        except Exception, e:
89
            print e
90
            print e
90
            return None
91
            return None
91
    return con
92
    return con
92
 
93
 
-
 
94
def get_mongo_connection_dtr_data(host='45.33.50.227', port=27017):
-
 
95
    global conDtrData
-
 
96
    if conDtrData is None:
-
 
97
        print "Establishing connection %s host and port %d" %(host,port)
-
 
98
        try:
-
 
99
            conDtrData = pymongo.MongoClient(host, port)
-
 
100
        except Exception, e:
-
 
101
            print e
-
 
102
            return None
-
 
103
    return conDtrData
-
 
104
 
93
def to_java_date(py_timestamp):
105
def to_java_date(py_timestamp):
94
    try:
106
    try:
95
        java_date =  int(time.mktime(py_timestamp.timetuple())) * 1000 + py_timestamp.microsecond / 1000
107
        java_date =  int(time.mktime(py_timestamp.timetuple())) * 1000 + py_timestamp.microsecond / 1000
96
        return java_date
108
        return java_date
97
    except:
109
    except: