def set_proxy(self, proxy, update=True):
        """
        Set proxy for requests session
        """
        update_web_driver = False
        if self.current_proxy != proxy:
            # Did we change proxies?
            update_web_driver = True

        self.current_proxy = proxy
        if proxy is None:
            self.driver_args['service_args'] = self.default_service_args
        else:
            proxy_parts = cutil.get_proxy_parts(proxy)

            self.driver_args['service_args'].extend(['--proxy={host}:{port}'.format(**proxy_parts),
                                                     '--proxy-type={schema}'.format(**proxy_parts),
                                                     ])
            if proxy_parts.get('user') is not None:
                self.driver_args['service_args'].append('--proxy-auth={user}:{password}'.format(**proxy_parts))

        # Recreate webdriver with new proxy settings
        if update is True and update_web_driver is True:
            self._update()
Set proxy for requests session