From 03b9be9b904bf1dc6c75d200bd5bdc6c68e5b4b0 Mon Sep 17 00:00:00 2001 From: Simon Weber Date: Thu, 7 Jul 2022 22:29:10 -0400 Subject: [PATCH] add example to readme [closes #47] --- README.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/README.md b/README.md index 886ff01..26d8a68 100644 --- a/README.md +++ b/README.md @@ -9,6 +9,23 @@ `gpsoauth` allows python code to use the "master token" flow that KB Sriram described at . +```python +import gpsoauth + +email = 'example@gmail.com' +password = 'my-password' +android_id = '0123456789abcdef' + +master_response = gpsoauth.perform_master_login(email, password, android_id) +master_token = master_response['Token'] + +auth_response = gpsoauth.perform_oauth( + email, master_token, android_id, + service='sj', app='com.google.android.music', + client_sig='...') +token = auth_response['Auth'] +``` + This can be useful when writing code that poses as a Google app, like [gmusicapi does here](https://github.com/simon-weber/gmusicapi/blob/87a802ab3a59a7fa2974fd9755d59a55275484d9/gmusicapi/session.py#L267-L278).