@@ -0,0 +1,922 @@
+# -*- coding: utf-8 -*-%0Afrom __future__ import print_function, unicode_literals%0A%0Aimport requests%0Aimport click%0A%0A%0Aclass URLs:%0A    base = 'https://www.systembolaget.se/api/'%0A    login = base + 'user/authenticate'%0A%0A%0Aclass LoginException(Exception):%0A    pass%0A%0A%0Adef login(session, username, password):%0A    response = session.post(URLs.login, data=%7B'Username': username, 'Password': password%7D)%0A%0A    if not response.status_code == 200 or response.json()%5B'IsValid'%5D is False:%0A        raise LoginException('Incorrect username or password.')%0A%0A%0A@click.command()%0A@click.argument('username', envvar='BEER_USERNAME')%0A@click.argument('password', envvar='BEER_PASSWORD')%0Adef main(username, password):%0A    session = requests.Session()%0A%0A    try:%0A        login(session, username, password)%0A        print('Successfully logged in!')%0A%0A    except LoginException as e:%0A        print(e.message)%0A%0A    print()%0A%0A%0Aif __name__ == '__main__':%0A    main()%0A

Support for logging in.