Skip to content

Instantly share code, notes, and snippets.

@kpostekk
Last active Nov 30, 2021
Embed
What would you like to do?
Automatyczne logowanie do Librus Synergia. Może się przyda
import requests
def do_login(login: str, password: str):
session = requests.session()
session.get('https://api.librus.pl/OAuth/Authorization?client_id=46&response_type=code&scope=mydata')
session.post('https://api.librus.pl/OAuth/Authorization/Grant?client_id=46', data={
'action': 'login',
'login': login,
'pass': password
})
session.get('https://api.librus.pl/OAuth/Authorization/Grant?client_id=46')
print(session.get('https://synergia.librus.pl/uczen/index').text)
if __name__ == '__main__':
import sys
if len(sys.argv) != 3:
print('nie podałeś danych debilu, wywołuj w ten sposób: python3 login.py <login> <hasło>')
else:
do_login(sys.argv[1], sys.argv[2])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment