Subversion Repositories SmartDukaan

Rev

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

Rev 15204 Rev 15209
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_URL = "http://173.234.194.37:8800/"
21
PROXY_MESH = "us-ca.proxymesh.com:31280"
22
PROXY_LIST = ['108.186.244.30:8800','108.186.244.39:8800','108.186.244.46:8800' \
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' \
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' \
24
              ,'166.88.111.13:8800','192.126.186.135:8800','192.126.186.166:8800' \
25
              ,'166.88.111.49:8800']
25
              ,'166.88.111.49:8800']
26
 
26
 
Line 98... Line 98...
98
        gz.close()
98
        gz.close()
99
        return html
99
        return html
100
    return r.read()
100
    return r.read()
101
 
101
 
102
 
102
 
103
def fetchResponseUsingProxy(url, headers=headers):
103
def fetchResponseUsingProxy(url, headers=headers, livePricing=None):
-
 
104
    if livePricing is None:
104
    PROXY_URL = PROXY_LIST[random.randint(0, len(PROXY_LIST) -1)]
105
        PROXY_URL = PROXY_LIST[random.randint(0, len(PROXY_LIST) -1)]
-
 
106
    else:
-
 
107
        PROXY_URL = PROXY_MESH
105
    print PROXY_URL
108
    print PROXY_URL
106
    proxy = urllib2.ProxyHandler({'http': PROXY_URL})
109
    proxy = urllib2.ProxyHandler({'http': PROXY_URL})
107
    opener = urllib2.build_opener(proxy)
110
    opener = urllib2.build_opener(proxy)
108
    urllib2.install_opener(opener)
111
    urllib2.install_opener(opener)
109
    req = urllib2.Request(url,headers=headers)
112
    req = urllib2.Request(url,headers=headers)