def set_proxy(self, proxy_server, proxy_port, proxy_username,<EOL>proxy_password):
if proxy_server and proxy_port:<EOL><INDENT>if proxy_username and proxy_password:<EOL><INDENT>self.proxy = {<EOL>"<STR_LIT:http>": "<STR_LIT>".format(proxy_username,<EOL>proxy_password,<EOL>proxy_server,<EOL>proxy_port),<EOL>"<STR_LIT>": "<STR_LIT>".format(proxy_username,<EOL>proxy_password,<EOL>proxy_server,<EOL>proxy_port),<EOL>}<EOL><DEDENT>else:<EOL><INDENT>self.proxy = {<EOL>"<STR_LIT:http>": "<STR_LIT>".format(proxy_server, proxy_port),<EOL>"<STR_LIT>": "<STR_LIT>".format(proxy_server, proxy_port),<EOL>}<EOL><DEDENT><DEDENT>
Sets a proxy on the Session

        :param str proxy_server: the proxy server
        :param int proxy_port: the proxy port, defaults to 8080
        :param str proxy_username: the proxy username
        :param str proxy_password: the proxy password