Subversion Repositories SmartDukaan

Rev

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

Rev 15249 Rev 15338
Line 16... Line 16...
16
            'Accept-Language' : 'en-US,en;q=0.8',                     
16
            'Accept-Language' : 'en-US,en;q=0.8',                     
17
            'Accept-Charset' : 'ISO-8859-1,utf-8;q=0.7,*;q=0.3',
17
            'Accept-Charset' : 'ISO-8859-1,utf-8;q=0.7,*;q=0.3',
18
            'Connection':'keep-alive',
18
            'Connection':'keep-alive',
19
            'Accept-Encoding' : 'gzip,deflate,sdch'
19
            'Accept-Encoding' : 'gzip,deflate,sdch'
20
        }
20
        }
21
PROXY_MESH = "us-ca.proxymesh.com:31280"
21
PROXY_MESH_LIVE = "us-ca.proxymesh.com:31280"
22
PROXY_LIST = ['108.186.244.30:8800','108.186.244.39:8800','108.186.244.46:8800' \
-
 
23
              ,'166.88.107.119:8800','166.88.107.74:8800','108.186.244.40:8800' \
-
 
24
              ,'166.88.111.13:8800','192.126.186.135:8800','192.126.186.166:8800' \
-
 
25
              ,'166.88.111.49:8800']
22
PROXY_MESH_GENERAL = "us-il.proxymesh.com:31280"
26
 
23
 
27
PUSH_NOTIFICATION_URL='http://api.profittill.com/admin/users/push'
24
PUSH_NOTIFICATION_URL='http://api.profittill.com/admin/users/push'
28
DTR_API_BASIC_AUTH = base64.encodestring('%s:%s' % ("dtr", "dtr18Feb2015")).replace('\n', '')
25
DTR_API_BASIC_AUTH = base64.encodestring('%s:%s' % ("dtr", "dtr18Feb2015")).replace('\n', '')
29
 
26
 
30
def get_mongo_connection(host='localhost', port=27017):
27
def get_mongo_connection(host='localhost', port=27017):
Line 100... Line 97...
100
    return r.read()
97
    return r.read()
101
 
98
 
102
 
99
 
103
def fetchResponseUsingProxy(url, headers=headers, livePricing=None):
100
def fetchResponseUsingProxy(url, headers=headers, livePricing=None):
104
    if livePricing is None:
101
    if livePricing is None:
105
        PROXY_URL = PROXY_LIST[random.randint(0, len(PROXY_LIST) -1)]
102
        PROXY_URL = PROXY_MESH_GENERAL
106
    else:
103
    else:
107
        PROXY_URL = PROXY_MESH
104
        PROXY_URL = PROXY_MESH_LIVE
108
    print PROXY_URL
105
    print PROXY_URL
109
    proxy = urllib2.ProxyHandler({'http': PROXY_URL})
106
    proxy = urllib2.ProxyHandler({'http': PROXY_URL})
110
    opener = urllib2.build_opener(proxy)
107
    opener = urllib2.build_opener(proxy)
111
    urllib2.install_opener(opener)
108
    urllib2.install_opener(opener)
112
    req = urllib2.Request(url,headers=headers)
109
    req = urllib2.Request(url,headers=headers)