Subversion Repositories SmartDukaan

Rev

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

Rev 14176 Rev 14541
Line 16... Line 16...
16
    def __init__(self):
16
    def __init__(self):
17
        self.count_trials = 0
17
        self.count_trials = 0
18
        self.redirectCount = 0
18
        self.redirectCount = 0
19
    
19
    
20
    def read(self, url):
20
    def read(self, url):
21
        request = urllib2.Request(url,headers=headers)
-
 
22
        response_data = ""
-
 
23
        try:
21
        try:
-
 
22
            proxy = urllib2.ProxyHandler({'http': 'http://192.161.163.60:8800'})
-
 
23
            opener = urllib2.build_opener(proxy)
-
 
24
            urllib2.install_opener(opener)
24
            response = urllib2.urlopen(request)
25
            response = urllib2.urlopen(url)
25
            response_data = response.read()
26
            response_data = response.read()
-
 
27
            print response_data
26
            response.close()
28
            response.close()
-
 
29
#        try:
-
 
30
#            response = urllib2.urlopen(request)
-
 
31
#            response_data = response.read()
-
 
32
#            response.close()
27
            print "Fetched response from flipkart for %s" %(url)
33
#            print "Fetched response from flipkart for %s" %(url)
28
 
34
 
29
        except Exception as e:
35
        except Exception as e:
30
            print 'ERROR: ', e
36
            print 'ERROR: ', e
31
            print 'Retrying'
37
            print 'Retrying'
32
            self.count_trials += 1
38
            self.count_trials += 1