import requests
# The last bit in the endpoint string points to the database it should query
endpoint = "https://api.notion.com/v1/databases/e51a1728e5494821a2ae9c625913846a"
# Replace the Authorization bearer token
headers = {"Authorization": "Bearer <REPLACE_ME>", "Notion-Version": "2021-08-16"}
# Get request that is transformed to a JSON
response = requests.get(endpoint, headers=headers).json()
print(response)
{'object': 'database', 'id': 'e51a1728-e549-4821-a2ae-9c625913846a', 'cover': None, 'icon': {'type': 'emoji', 'emoji': '📺'}, 'created_time': '2021-11-07T14:57:00.000Z', 'last_edited_time': '2021-11-07T15:05:00.000Z', 'title': [{'type': 'text', 'text': {'content': 'Notion API example', 'link': None}, 'annotations': {'bold': False, 'italic': False, 'strikethrough': False, 'underline': False, 'code': False, 'color': 'default'}, 'plain_text': 'Notion API example', 'href': None}], 'properties': {'Tags': {'id': 'NywG', 'name': 'Tags', 'type': 'multi_select', 'multi_select': {'options': [{'id': '741f549d-179f-4a24-91d2-583e599707f1', 'name': 'Lead', 'color': 'default'}, {'id': 'd272925a-bfe3-4ffd-8a07-611ce0e27973', 'name': 'To reach out', 'color': 'purple'}]}}, 'Company': {'id': 'nrRd', 'name': 'Company', 'type': 'rich_text', 'rich_text': {}}, 'Name': {'id': 'title', 'name': 'Name', 'type': 'title', 'title': {}}}, 'parent': {'type': 'page_id', 'page_id': '71cef1fe-0642-410b-9d88-7acde89c65da'}, 'url': 'https://www.notion.so/e51a1728e5494821a2ae9c625913846a'}
print(response['title'])
[{'type': 'text', 'text': {'content': 'Notion API example', 'link': None}, 'annotations': {'bold': False, 'italic': False, 'strikethrough': False, 'underline': False, 'code': False, 'color': 'default'}, 'plain_text': 'Notion API example', 'href': None}]