Subversion Repositories SmartDukaan

Rev

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

Rev 14737 Rev 14738
Line 12... Line 12...
12
            'Accept-Language' : 'en-US,en;q=0.8',                     
12
            'Accept-Language' : 'en-US,en;q=0.8',                     
13
            'Accept-Charset' : 'ISO-8859-1,utf-8;q=0.7,*;q=0.3',
13
            'Accept-Charset' : 'ISO-8859-1,utf-8;q=0.7,*;q=0.3',
14
            'Connection':'keep-alive',
14
            'Connection':'keep-alive',
15
            'Accept-Encoding' : 'gzip,deflate,sdch'
15
            'Accept-Encoding' : 'gzip,deflate,sdch'
16
        }
16
        }
17
proxy = "http://192.161.163.60:8800"
17
PROXY_URL = "http://192.161.163.60:8800"
18
def get_mongo_connection(host='localhost', port=27017):
18
def get_mongo_connection(host='localhost', port=27017):
19
    global con
19
    global con
20
    if con is None:
20
    if con is None:
21
        print "Establishing connection %s host and port %d" %(host,port)
21
        print "Establishing connection %s host and port %d" %(host,port)
22
        try:
22
        try:
Line 90... Line 90...
90
        return html
90
        return html
91
    return r.read()
91
    return r.read()
92
 
92
 
93
 
93
 
94
def fetchResponseUsingProxy(url, headers=headers):
94
def fetchResponseUsingProxy(url, headers=headers):
95
    proxy = urllib2.ProxyHandler({'http': proxy})
95
    proxy = urllib2.ProxyHandler({'http': PROXY_URL})
96
    opener = urllib2.build_opener(proxy)
96
    opener = urllib2.build_opener(proxy)
97
    urllib2.install_opener(opener)
97
    urllib2.install_opener(opener)
98
    req = urllib2.Request(url,headers=headers)
98
    req = urllib2.Request(url,headers=headers)
99
    response = urllib2.urlopen(req)
99
    response = urllib2.urlopen(req)
100
    response_data = ungzipResponse(response)
100
    response_data = ungzipResponse(response)