Sainsbury's SmartShop Python lib
- Python 100%
| libssa | shop: remove Shop.items(), it was never actually in the API | |
| .gitignore | Remove repetition in the Shop class; Add more endpoints; Fix imports | |
| LICENSE | commit message | |
| pyproject.toml | commit message | |
| README.md | readme tweak | |
libssa
Python wrapper for the Sainsbury's SmartShop API.
WARNING: This is influenced by decompiled code from the app. Especially the Client.basic_auth() method (you'd need the app to figure out that thing anyway). If you don't like any implications of that, avoid!
Not sure if it matters, but just so you know.
Installation
pip install git+https://codeberg.org/plate/libssa
Usage
Use the Client class:
from libssa.client import Client
c = Client()
This defaults to the Android client. You can also supply a custom client ID and key (likely not needed):
from libssa import constants
c = Client(client_id=constants.HANDSET_CLIENT_ID, rsa_key=constants.HANDSET_KEY)
c = Client(client_id="ss_whatever_mobile_1k", rsa_key="-----BEGIN RSA PUBLIC KEY-----...")
Then you can log in as needed:
c.login_nectar("12345678900") # last 11 digits: 9623000 12345678900
Starting a shop returns a Shop (libssa.shop.Shop) object:
s = c.create_shop("1234") # start shopping at your store id
s.add_item("123456", 10) # add 10 of this item
s.finish() # finish the shop
s.move_to_pos("12") # send it to POS 12
When a request fails, you want to catch libssa.errors.RequestError, which has the
status_code and content properties.