add check for login required

Authored by: bashonly
This commit is contained in:
bashonly 2024-10-29 15:27:35 -05:00
parent 2309b88c1a
commit bf0cf9995d
No known key found for this signature in database
GPG key ID: 783F096F253D15B0

View file

@ -32,6 +32,11 @@ def _perform_login(self, username, password):
}).encode())
self._API_HEADERS['Authorization'] = f'{response["token_type"]} {response["access_token"]}'
def _real_initialize(self):
if not self._API_HEADERS.get('Authorization'):
self.raise_login_required(
'This content is only available with purchase', method='password')
def _entries(self, data, course_id):
course_list = []
for section in data['data']['sections']: