mechanize python xe 232

Solutions on MaxInterview for mechanize python xe 232 by the best coders in the world

showing results for - "mechanize python xe 232"
Ricardo
17 Aug 2019
1def get_browser(self):
2        '''Returns a mechanize.Browser object configured with the framework's global options.'''
3        br = mechanize.Browser()
4        # set the user-agent header
5        br.addheaders = [('User-agent', self._global_options['user-agent'])]
6        # set debug options
7        if self._global_options['verbosity'] >= 2:
8            br.set_debug_http(True)
9            br.set_debug_redirects(True)
10            br.set_debug_responses(True)
11        # set proxy
12        if self._global_options['proxy']:
13            br.set_proxies({'http': self._global_options['proxy'], 'https': self._global_options['proxy']})
14        # additional settings
15        br.set_handle_robots(False)
16        # set timeout
17        socket.setdefaulttimeout(self._global_options['timeout'])
18        return br 
similar questions
queries leading to this page
mechanize python xe 232