The traceback states "FileNotFoundError: [Errno 2] No such file or directory" and then lists a byte string that looks identical to a XML file:
The core problem is that the expected filepath is a XML-formatted byte string.
Nevermind. I see what you're on about now. The documentation for requests.Session indicate that the username and password need to be set to the object, not just passed into the post() method:
Quote:b'\r\n\r\n<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">\r\n<html>\r\n <head>\r\n\t<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">\r\n <title>THE Batch Server</title>\r\n <link rel="stylesheet" type="text/css" href="css/page.css"/>\r\n </head>\r\n <body>\r\n <h1> <img height="22" width="22" src="images/batchdefault.png"/> THE Batch Server Login</h1>\r\n \r\n \r\n Please log in to THE Batch Server with valid user which has access to use case \'Scheduled Jobs\'.\r\n \r\n <p/>\r\n <form method="post" action="login">\r\n <table border="0">\r\n <tbody>\r\n <tr>\r\n <td>User ID</td>\r\n <td>\r\n \r\n <input type="text" name="username">\r\n \r\n </td>\r\n </tr>\r\n <tr>\r\n <td>Password</td>\r\n <td><input type="password" name="password"></td>\r\n </tr>\r\n </tbody>\r\n </table>\r\n <input type="submit" value="Submit">\r\n </form>\r\n </body>\r\n</html>'
The core problem is that the expected filepath is a XML-formatted byte string.
Nevermind. I see what you're on about now. The documentation for requests.Session indicate that the username and password need to be set to the object, not just passed into the post() method:
s = requests.Session() s.auth = ('user', 'pass') s.headers.update({'x-test': 'true'}) # both 'x-test' and 'x-test2' are sent s.get('https://httpbin.org/headers', headers={'x-test2': 'true'})Try setting s.auth with the username and password.