A minimal last.fm scrobbling library written in Python 3.6
pip install scrobbless
You must register for an API account on last.fm: https://www.last.fm/api/account/create
For using the program, two environment variables have to be set: SCROBBLESS_API_KEY and SCROBBLESS_SECRET_KEY.
First, you must request a token:
s = Scrobbless()
token = s.get_token()
With that token, you auth the user, which will open a browser with a button to click
s.auth_user(token)
After that, you will receive the session key, which is passed with every request to the last.fm server:
session = s.get_session(token)
session_key = session['session']['key']
The session key lasts a long time so it should be saved somewhere and reused.
After completing this process, you can start scrobbling:
scrobble(artist, track, album, timestamp, session_key)
scrobbles a song.
update_np(artist, track, album, session_key)
sets a song as 'now playing'.
A basic example is located here: https://github.com/sebojanko/scrobbless/blob/master/scrobbless/scrobbless_tester.py
GNU GPL v3