Skip to content
This repository was archived by the owner on Nov 2, 2023. It is now read-only.
This repository was archived by the owner on Nov 2, 2023. It is now read-only.

HTTPError: 429 Client Error: Too Many Requests for url #51

@FUTUREEEEEE

Description

@FUTUREEEEEE

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions