Last active
November 30, 2021 19:29
-
-
Save kpostekk/aa6e36c78f7be33719ac5d9b8c0264d5 to your computer and use it in GitHub Desktop.
Automatyczne logowanie do Librus Synergia. Może się przyda
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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