Subversion Repositories SmartDukaan

Rev

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

Rev 13678 Rev 13690
Line 96... Line 96...
96
        raise NotImplementedError
96
        raise NotImplementedError
97
    
97
    
98
    def scrapeStoreOrders(self,):
98
    def scrapeStoreOrders(self,):
99
        raise NotImplementedError
99
        raise NotImplementedError
100
    
100
    
-
 
101
    def _saveToOrder(self, order):
-
 
102
        collection = self.db.merchantOrder
-
 
103
        try:
-
 
104
            order = collection.insert(order)
-
 
105
            #merchantOder 
-
 
106
        except Exception as e:
-
 
107
            traceback.print_exc()
101
    
108
    
102
    def getCashbackAmount(self, productCode, amount):
109
    def getCashbackAmount(self, productCode, amount):
103
        alagvar = CASHBACK_URL % (self.store_id,productCode)
110
        alagvar = CASHBACK_URL % (self.store_id,productCode)
104
        filehandle = urllib2.Request(alagvar,headers=headers)
111
        filehandle = urllib2.Request(alagvar,headers=headers)
105
        x= urllib2.urlopen(filehandle)
112
        x= urllib2.urlopen(filehandle)
Line 185... Line 192...
185
                     ('Accept-Encoding', 'gzip,deflate,sdch'),                  
192
                     ('Accept-Encoding', 'gzip,deflate,sdch'),                  
186
                     ('Accept-Language', 'en-US,en;q=0.8'),                     
193
                     ('Accept-Language', 'en-US,en;q=0.8'),                     
187
                     ('Accept-Charset', 'ISO-8859-1,utf-8;q=0.7,*;q=0.3')]
194
                     ('Accept-Charset', 'ISO-8859-1,utf-8;q=0.7,*;q=0.3')]
188
    return br
195
    return br
189
 
196
 
-
 
197
def ungzipResponse(r):
-
 
198
    headers = r.info()
-
 
199
    if headers['Content-Encoding']=='gzip':
-
 
200
        import gzip
-
 
201
        print "********************"
-
 
202
        print "Deflating gzip response"
-
 
203
        print "********************"
-
 
204
        gz = gzip.GzipFile(fileobj=r, mode='rb')
-
 
205
        html = gz.read()
-
 
206
        gz.close()
-
 
207
        return html