-
Hi! I'm new to coding...can you please give me some examples of anything? Especially how to create a block...Python continuously gives me an error KeyError: 'secret_...' but I'm sure that all the codes are ok. This is what I was searching to do: from pprint import pprint
from notion_client import Client
import os
notion = Client(auth=os.environ["secret_123456789012345678901234567890"])
notion.pages.create({
parent: {
database_id: '12345678901234567890',
},
properties: {
Name: {
title: [
{
text: {
content: 'Giargiana',
}
}
]
}
}
}
) Edit by ramnes: I removed a token and beautified code. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 9 replies
-
This is a duplicate question. Read this #23. Please search existing questions before asking one. You could have typed "KeyError" in the search bar of GitHub discussions. Learn markdown to format your code in your question. Read the Quick Start guide. This guide gives the correct code to try out this library. You can see first project example after reading the quick start guide. Please explore the documentation and readme before asking questions. Also, make sure to google search your error message. If you have google searched "python key error" you would have got some idea about the mistake you were making. From your code it seems that you don't know about
this line is wrong. This is not how you load environment variables. you must give the name of the environment variable. The key of the The correct code is this notion = Client(auth=os.environ["NOTION_TOKEN"]) You must set the value of In your terminal, you can run. export NOTION_TOKEN=secret123abc... You can also use a |
Beta Was this translation helpful? Give feedback.
This is a duplicate question. Read this #23. Please search existing questions before asking one. You could have typed "KeyError" in the search bar of GitHub discussions. Learn markdown to format your code in your question.
Read the Quick Start guide. This guide gives the correct code to try out this library.
You can see first project example after reading the quick start guide.
Please explore the documentation and readme before asking questions. Also, make sure to google search your error message.
If you have google searched "python key error" you would have got some idea about the mistake you were making.
From your code it seems that you don't know about
os.environ
. Read this article t…