@classmethod<EOL><INDENT>def from_user_creds(cls, username, password, url=URL_BASE):<DEDENT>
session = requests.session()<EOL>token_resp = session.post(url.rstrip('<STR_LIT:/>') + '<STR_LIT>',<EOL>data={'<STR_LIT:username>': username,<EOL>'<STR_LIT:password>': password})<EOL>if token_resp.status_code != <NUM_LIT:200>:<EOL><INDENT>error = token_resp.text<EOL>try:<EOL><INDENT>error = json.loads(error)['<STR_LIT:error>']<EOL><DEDENT>except (KeyError, ValueError):<EOL><INDENT>pass<EOL><DEDENT>raise LuminosoLoginError(error)<EOL><DEDENT>return cls(token_resp.json()['<STR_LIT:result>']['<STR_LIT>'])<EOL>
Obtain a short-lived token using a username and password, and use that
token to create an auth object.