Skip to content

Instantly share code, notes, and snippets.

@alexbowe
Last active February 23, 2023 23:48
Show Gist options
  • Save alexbowe/22275a42596a8eacb6ccd318a684915f to your computer and use it in GitHub Desktop.
Save alexbowe/22275a42596a8eacb6ccd318a684915f to your computer and use it in GitHub Desktop.
Get Readwise Highlights
import requests
READWISE_API_KEY = "" # Go to readwise.io/access_token
def get_readwise_data():
next_page = None
while True:
# See https://readwise.io/api_deets for more info
response = requests.get(
url="https://readwise.io/api/v2/export/",
params={"pageCursor": next_page},
headers={"Authorization": f"Token {READWISE_API_KEY}"})
yield from response.json()["results"]
next_page = response.json().get("nextPageCursor")
if not next_page: break
print([*get_readwise_data()])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment