Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions repltalk/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1009,6 +1009,33 @@ async def login(self, username, password):
connectsid = str(dict(r.cookies)['connect.sid'].value)
self.sid = connectsid
return self
async def login_old(self, username, password):
if username.lower() not in whitelisted_bots:
raise NotWhitelisted(
f'{username} is not whitelisted and therefore is not allowed to log in.\n'
'Please ask mat#6207 if you would like to be added to the whitelist.'
)

async with aiohttp.ClientSession(
headers={'referer': self.default_ref}
) as s:
async with s.post(
base_url + '/login',
json={
'username': username,
'password': password,
'teacher': False
},
headers={
'X-Requested-With': username
}
) as r:
if await r.text() == '{"message":"Invalid username or password."}':
raise InvalidLogin('Invalid username or password.')
# Gets the connect.sid cookie
connectsid = str(dict(r.cookies)['connect.sid'].value)
self.sid = connectsid
return self

async def _get_reports(self, resolved):
reports = await self.perform_graphql(
Expand Down