import requests import json import random url = "https://api.notion.com/v1/databases/180f4b492f4d421c88028c54cfe077a5/query" payload = json.dumps({ "filter": { "property": "Weekly Rotation", "checkbox": { "equals": True } } }) headers = { 'Authorization': 'Bearer secret_oG3PIzAL10np4NadmID4X93ISNJP7zHBr6CQ8Oskakb', 'Content-Type': 'application/json', 'Notion-Version': '2022-02-22' } response = requests.request("POST", url, headers=headers, data=payload) recipes = response.json() n_recipes = 10 for recipe in random.sample(recipes['results'], n_recipes): print(recipe["properties"]["Name"]["title"][0]["plain_text"].strip()) print(recipe["url"])