Subversion Repositories SmartDukaan

Rev

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

Rev 20615 Rev 21268
Line 389... Line 389...
389
###
389
###
390
#Settlement process is suposed to be a batch and run weekly
390
#Settlement process is suposed to be a batch and run weekly
391
#It is should be running on first hour of mondays. As cron should
391
#It is should be running on first hour of mondays. As cron should
392
# Maintain a batch id.
392
# Maintain a batch id.
393
 
393
 
394
 
-
 
-
 
394
agentDefault = 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/535.11 (KHTML, like Gecko) Chrome/17.0.963.56 Safari/535.11'
395
def getBrowserObject():
395
def getBrowserObject(agent = agentDefault):
396
    import cookielib
396
    import cookielib
397
    br = mechanize.Browser(factory=mechanize.RobustFactory())
397
    br = mechanize.Browser(factory=mechanize.RobustFactory())
398
    cj = cookielib.LWPCookieJar()
398
    cj = cookielib.LWPCookieJar()
399
    br.set_cookiejar(cj)
399
    br.set_cookiejar(cj)
400
    br.set_handle_equiv(True)
400
    br.set_handle_equiv(True)
Line 405... Line 405...
405
    br.set_debug_redirects(False)
405
    br.set_debug_redirects(False)
406
    br.set_debug_responses(False)
406
    br.set_debug_responses(False)
407
    
407
    
408
    br.set_handle_refresh(mechanize._http.HTTPRefreshProcessor(), max_time=1)
408
    br.set_handle_refresh(mechanize._http.HTTPRefreshProcessor(), max_time=1)
409
    
409
    
410
    br.addheaders = [('User-agent','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/535.11 (KHTML, like Gecko) Chrome/17.0.963.56 Safari/535.11'),
410
    br.addheaders = [('User-Agent', agent),
411
                     ('Accept', 'text/html,application/xhtml+xml,application/json,application/xml;q=0.9,*/*;q=0.8'),
411
                     ('Accept', 'text/html,application/xhtml+xml,application/json,application/xml;q=0.9,*/*;q=0.8'),
412
                     ('Accept-Encoding', 'gzip,deflate,sdch'),                  
412
                     ('Accept-Encoding', 'gzip,deflate,sdch'),                  
413
                     ('Accept-Language', 'en-US,en;q=0.8'),                     
413
                     ('Accept-Language', 'en-US,en;q=0.8'),                     
414
                     ('Accept-Charset', 'ISO-8859-1,utf-8;q=0.7,*;q=0.3')]
414
                     ('Accept-Charset', 'ISO-8859-1,utf-8;q=0.7,*;q=0.3')]
415
    return br
415
    return br