md2notion icon indicating copy to clipboard operation
md2notion copied to clipboard

HTTPError: 429 Client Error: Too Many Requests for url

Open FUTUREEEEEE opened this issue 3 years ago • 2 comments

Hi, I keep getting this error when running this program. even through i add time.sleep(120) ....

from notion.client import NotionClient
from notion.block import PageBlock
from md2notion.upload import upload
from md2notion.NotionPyRenderer import NotionPyRenderer,addHtmlImgTagExtension,addLatexExtension
from md2notion.upload import convert, uploadBlock
import time

client = NotionClient(token_v2=xxx)
page = client.get_block("https://www.notion.so/2ef891ab83c54b6f8081fa9169b2e91f")

notionPyRendererCls = NotionPyRenderer
notionPyRendererCls = addHtmlImgTagExtension(notionPyRendererCls)
notionPyRendererCls = addLatexExtension(notionPyRendererCls)

with open("D:\BaiduNetdiskDownload\Basic.md", "r", encoding="utf-8") as mdFile:
    rendered = convert(mdFile,notionPyRendererCls=notionPyRendererCls)

for blockDescriptor in rendered:
    uploadBlock(blockDescriptor, page, mdFile.name)
    time.sleep(120)

complete output :

h4 not supported in Notion.so, converting to h3
Code block language python3 has no corresponding syntax in Notion.so
Code block language python3 has no corresponding syntax in Notion.so
h4 not supported in Notion.so, converting to h3
Uploading file 'D:\BaiduNetdiskDownload\Basic.assets\image-20220509203014475.png'
Uploading file 'D:\BaiduNetdiskDownload\Basic.assets\watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L2xvdmVwMQ==,size_16,color_FFFFFF,t_70-16520977311302.png'
Uploading file 'D:\BaiduNetdiskDownload\Basic.assets\311436_1552801230080_095961B16BE2B8C2E508F4A1AB257B7D.png'
Uploading file 'D:\BaiduNetdiskDownload\Basic.assets\image-20220510122123499.png'
Traceback (most recent call last):
  File "C:\Users\tangxiaqiang\PycharmProjects\tmp\tmp.py", line 20, in <module>
    uploadBlock(blockDescriptor, page, mdFile.name)
  File "C:\Users\tangxiaqiang\Anaconda3\lib\site-packages\md2notion\upload.py", line 91, in uploadBlock
    newBlock.upload_file(str(imgSrc))
  File "C:\Users\tangxiaqiang\Anaconda3\lib\site-packages\notion\block.py", line 652, in upload_file
    self.display_source = data["url"]
  File "C:\Users\tangxiaqiang\Anaconda3\lib\site-packages\notion\maps.py", line 50, in fset
    self.set(path, python_to_api(value, **kwargs))
  File "C:\Users\tangxiaqiang\Anaconda3\lib\site-packages\notion\records.py", line 115, in set
    self._client.submit_transaction(
  File "C:\Users\tangxiaqiang\Anaconda3\lib\site-packages\notion\client.py", line 290, in submit_transaction
    self.post("submitTransaction", data)
  File "C:\Users\tangxiaqiang\Anaconda3\lib\site-packages\notion\client.py", line 265, in post
    response.raise_for_status()
  File "C:\Users\tangxiaqiang\Anaconda3\lib\site-packages\requests\models.py", line 960, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 429 Client Error: Too Many Requests for url: https://www.notion.so/api/v3/submitTransaction

FUTUREEEEEE avatar Aug 15 '22 08:08 FUTUREEEEEE

I found another tool that can replace both enex2md and md2notion https://www.reddit.com/r/Notion/comments/r5nnry/alternative_way_of_importing_notebooks_from/

Mr-Smilin avatar Sep 30 '22 02:09 Mr-Smilin

I also encountered this problem

song-hailong avatar Apr 19 '23 12:04 song-hailong