Subversion Repositories SmartDukaan

Rev

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

Rev 16660 Rev 16736
Line 45... Line 45...
45
ORDER_SHIPPED = 'Shipped' #Lets see if we can make use of it
45
ORDER_SHIPPED = 'Shipped' #Lets see if we can make use of it
46
ORDER_CANCELLED = 'Cancelled'
46
ORDER_CANCELLED = 'Cancelled'
47
 
47
 
48
AFFILIATE_OFFER_API= {1:"https://www.spicesafar.com/FreeBapp/fetchOffersSM?deviceId=%s&retailerCode=%d"}
48
AFFILIATE_OFFER_API= {1:"https://www.spicesafar.com/FreeBapp/fetchOffersSM?deviceId=%s&retailerCode=%d"}
49
AFFILIATE_OFFER_DESC_API = {1:"https://www.spicesafar.com/FreeBapp/individualOffersSM?deviceId=%s&offerId=%s&retailerCode=%d"}
49
AFFILIATE_OFFER_DESC_API = {1:"https://www.spicesafar.com/FreeBapp/individualOffersSM?deviceId=%s&offerId=%s&retailerCode=%d"}
50
 
-
 
-
 
50
CREDIT_TYPE_ORDER = "Order"
-
 
51
CREDIT_TYPE_APP = "App"
51
 
52
 
52
def get_mongo_connection(host='localhost', port=27017):
53
def get_mongo_connection(host='localhost', port=27017):
53
    global con
54
    global con
54
    if con is None:
55
    if con is None:
55
        print "Establishing connection %s host and port %d" %(host,port)
56
        print "Establishing connection %s host and port %d" %(host,port)
Line 129... Line 130...
129
        return html
130
        return html
130
    return r.read()
131
    return r.read()
131
 
132
 
132
 
133
 
133
def fetchResponseUsingProxy(url, headers=headers, livePricing=None, proxy=True):
134
def fetchResponseUsingProxy(url, headers=headers, livePricing=None, proxy=True):
134
    if livePricing is None:
135
#    if livePricing is None:
135
        PROXY_URL = PROXY_MESH_GENERAL
136
#        PROXY_URL = PROXY_MESH_GENERAL
136
    else:
137
#    else:
137
        PROXY_URL = PROXY_MESH_LIVE
138
#        PROXY_URL = PROXY_MESH_LIVE
138
    if proxy:
139
#    if proxy:
139
        print PROXY_URL
140
#        print PROXY_URL
140
        proxy = urllib2.ProxyHandler({'http': PROXY_URL})
141
#        proxy = urllib2.ProxyHandler({'http': PROXY_URL})
141
        opener = urllib2.build_opener(proxy)
142
#        opener = urllib2.build_opener(proxy)
142
        urllib2.install_opener(opener)
143
#        urllib2.install_opener(opener)
143
    req = urllib2.Request(url,headers=headers)
144
    req = urllib2.Request(url,headers=headers)
144
    response = urllib2.urlopen(req)
145
    response = urllib2.urlopen(req)
145
    response_data = ungzipResponse(response)
146
    response_data = ungzipResponse(response)
146
    response.close()
147
    response.close()
147
    return response_data
148
    return response_data