-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Timetable URL error #5
Comments
Натыкал новые результаты. Курл и питон тут не причём, как я и изначально думал. Дело в том где генерится токен. Если токен был сгенерен в браузере, то всё супер. З.Ы. энивей нужно допилить парсер в питоне, а то он их не кушает, там немного другая структура. |
async def login(self, email: str, password: str) -> bool:
AUTH = f'https://lk.sut.ru/cabinet/lib/autentificationok.php?users={email}&parole={password}'
CABINET = 'https://lk.sut.ru/cabinet/'
try:
async with aiohttp.ClientSession() as session:
async with session.get(CABINET) as response:
response.raise_for_status()
self.cookies = response.cookies
async with session.post(AUTH) as response:
response.raise_for_status()
text = await response.text()
if text == '1':
async with session.get(CABINET) as response:
response.raise_for_status()
return True
else:
return False
except Exception as e:
return False async def raspisanie(self):
URL = 'https://lk.sut.ru/cabinet/project/cabinet/forms/raspisanie_all.php'
async with aiohttp.ClientSession() as session:
async with session.get(URL, cookies=self.cookies) as response:
response.raise_for_status()
text = await response.text()
with open('raspisanie_all.html', 'w') as f:
f.write(text)
return text |
@iwtcode Я догадывался, что возможно что-то с редиректом, или какая-то другая тривиальная проблема, но времени не было с этим возиться. Но, чему я действительно офигел, что кто-то заметил мою, репу, чекнул сорцы, и отписал в ишью. Мужик, пасиба. З.ы. всё работает, закрою ишью как кину pr, заодно смержу #4, и сразу выкачу релиз. respect++ |
При запросе на адрес:
Из питона(и из аиохттп, и из requests) получаем:
Из курла, и самого браузера все ок.
На
Выплювывает
The text was updated successfully, but these errors were encountered: