def get_session(key=None, username=None, password=None, cache=True,<EOL>cache_expiry=datetime.timedelta(days=<NUM_LIT:7>), cookie_path=COOKIE_PATH, backend='<STR_LIT>',<EOL>version=VERSION_GLOBAL):
class VooblyAuth(AuthBase):  <EOL><INDENT>"""<STR_LIT>"""<EOL>def __init__(self, key, username, password, cookie_path, version):<EOL><INDENT>"""<STR_LIT>"""<EOL>self.key = key<EOL>self.username = username<EOL>self.password = password<EOL>self.cookie_path = cookie_path<EOL>self.base_url = BASE_URLS[version]<EOL><DEDENT>def __call__(self, r):<EOL><INDENT>"""<STR_LIT>"""<EOL>return r<EOL><DEDENT><DEDENT>if version not in BASE_URLS:<EOL><INDENT>raise ValueError('<STR_LIT>')<EOL><DEDENT>session = requests.session()<EOL>if cache:<EOL><INDENT>session = requests_cache.core.CachedSession(expire_after=cache_expiry, backend=backend)<EOL><DEDENT>session.auth = VooblyAuth(key, username, password, cookie_path, version)<EOL>if os.path.exists(cookie_path):<EOL><INDENT>_LOGGER.info("<STR_LIT>", cookie_path)<EOL>session.cookies = _load_cookies(cookie_path)<EOL><DEDENT>return session<EOL>
Get Voobly API session.