Saravanan666/pypi-org huggingface dataset:
Package: notion-cli-py
NotionCLINotionCLI - The CLI tool for Notion.co (https://www.notion.so/ja-jp/product).InstallationTo install NotionCLI with pip, run:pip install notion-cli-pyHow to useCreate IntegrationTo use the notion api, you need to create an integration. Please create ithere.SetupAfter installation, you are required to create config file first.
Please run following command.$ notion-cli configure setThen you need to put your integration information about the following questions.Are you sure to create config file in /Users/hiratatomonori/.notion_cli? [y/N]: # Type 'y'.
input config label name: # Type your integration name (e.g. "NotionCLI").
input token for NotionCLI: # Type your integration token.
Do you want to set label (LABEL NAME) to current label? [y/N]: # Type 'y' (if this is your first setting).Please run following command and check that the configuration is completed properly.### Check if the target page has the integration that set above.
$ notion-cli get pages ${PAGE_ID}If page information can be retrieved the minimum setup is complete.Basic CommandsFor more detailed information, runnotion-cli <command> - --helpornotion-cli <command> <subcommand> - --help.Get (Retrieve) Operations### get pages information
$ notion-cli get pages ${PAGE_IDS}

### get pages properties
$ notion-cli get page_properties ${PAGE_IDS} ${PROPERTY_ID}

### get databases information
$ notion-cli get databases ${DATABASE_IDS}

### get blocks information
$ notion-cli get blocks ${BLOCK_IDS}

### get block children information
$ notion-cli get block_children ${BLOCK_IDS}

### get users information
$ notion-cli get users ${USERS_IDS}

### get all users information
$ notion-cli get all_usersCreate Operations### create pages
$ notion-cli create pages ${PALENT_PAGE_IDS} --read-path=${YOUR_FILE_PATH}

### create databases
$ notion-cli create databases ${PALENT_PAGE_IDS} --read-path=${YOUR_FILE_PATH}Update Operations### update pages
$ notion-cli update pages ${PALENT_PAGE_IDS} --read-path=${YOUR_FILE_PATH}

### update databases
$ notion-cli update databases ${PALENT_PAGE_IDS} --read-path=${YOUR_FILE_PATH}

### update blocks
$ notion-cli update blocks ${PALENT_PAGE_IDS} --read-path=${YOUR_FILE_PATH}Delete Operations### delete blocks
$ notion-cli delete blocks ${BLOCK_IDS}Append Operations### append block children
$ notion-cli append block_children ${BLOCK_IDS} --read-path=${YOUR_FILE_PATH}Configure Operations### set your integration information
$ notion-cli configure set

### show your integration information
$ notion-cli configure show

### switch integration
$ notion-cli configure switch ${LABEL_NAME}Query Operations### query databases
$ notion-cli query databases ${YOUR_FILE_PATH}Search Operations### search objects
$ notion-cli search data ${YOUR_FILE_PATH}LicenseLicensed under theMITLicense.DisclaimerThis isNOTan official Notion product.
Package: notion-database
Python Notion DatabaseDatabase of Pythonic Notion APIcreated by database from the official Notion API."notion database" is Notion API wrapper library.importosfromnotion_database.pageimportPagefromnotion_database.propertiesimportPropertiesfromnotion_database.const.queryimportDirection,Timestampfromnotion_database.searchimportSearchS=Search(integrations_token=os.getenv('NOTION_KEY'))S.search_database(query="",sort={"direction":Direction.ascending,"timestamp":Timestamp.last_edited_time})foriinS.result:PROPERTY=Properties()PROPERTY.set_title("title","title")PROPERTY.set_rich_text("Description","description text")P=Page(integrations_token=os.getenv('NOTION_KEY'))P.create_page(database_id=i["id"],properties=PROPERTY)See detailed examplehere.License Noticehope that many people will use this package, also license has been changed to LGPL 3 from 1.0.previous version is GPL, please be careful when using this out of version.What's new notion-version1.0.0Now that we've implemented all features,change the version rule to the semantic version.notion-version : "2022-06-28"2022.08.01Update notion-version (2022-06-28)2022.03.27Update notion-version (2022-02-22)Using officially API (out of beta!).https://developers.notion.com/changelog/releasing-notion-version-2022-02-222021.09.01Update notion-version (2021-08-16)Installing / Getting startedpipinstallnotion-databaseDocshttps://notion-database.readthedocs.ioBuilding / Developingpythonsetup.pyinstallFeaturesBlocks✅ Append block children✅ Retrieve block childrenPages✅ Create a page✅ Retrieve a page✅ Retrieve a page property item✅ Update page properties✅ Archive a pageDatabases✅ Create a database✅ Query a databaseSee detailed examplehere.✅ Retrieve a database✅ Update a database✅ Update database propertiesBlocks✅ Retrieve a block✅ Retrieve block childrenContributingIf you'd like to contribute, please fork the repository and use a feature branch. Pull requests are warmly welcome.LinksNotion API :https://developers.notion.comLicensingThe code in this project is licensed under LGPL license.Example project using this packagejira-2-notion-dbhttps://github.com/minwook-shin/jira-2-notion-db
Package: notion-database-bot
Notion Database BotNotion-Database-Bot is a python tool for synchronizing data in Notion Database through Notion official api. The main purpose is to facilitate the recording of daily experimental data.Installationpip install notion-database-botPrerequisitesCreate an integration, then you can get your own Internal Integration Token (token).Share a database with your integration.Get your target database ID (database_id):Here's a quick procedure to find the database ID for a specific database in Notion:Open the database as a full page in Notion. Use the Share menu to Copy link. Now paste the link in your text editor so you can take a closer look. The URL uses the following format:https://www.notion.so/{workspace_name}/{database_id}?v={view_id}Find the part that corresponds to {database_id} in the URL you pasted. It is a 36 character long string. This value is your database ID.
Note that when you receive the database ID from the API, e.g. the search endpoint, it will contain hyphens in the UUIDv4 format. You may use either the hyphenated or un-hyphenated ID when calling the API.UsageInit your Bot:fromnotion_database_botimportNotionDatabaseBotbot=NotionDatabaseBot(token)Read database content:content=bot.read_database(database_id)Add a page/row/sample to databasetemp_dict={"Model":"bert-base-uncased","ppl":"5.21"}properties=bot.dict2properties(temp_dict,"Model")bot.create_page(database_id,properties)References:https://developers.notion.com/https://prettystatic.com/notion-api-python/
Package: notiondb
NotionDBPython 3 tools for interacting with Notion API:API clientRelational database wrapperChangelog11/11: Add column list, column blockInstallationpip install notiondbAPI clientfromnotiondbimportNotionApiapi=NotionApi(API_TOKEN)# Token from Internal Integration# Databasesdatabases,next_cursor=api.get_databases()api.create_database(parent_id,title,properties)api.get_database(id)api.update_database(id,title,properties)pages,next_cursor=api.query_database(filter,sorts,start_cursor,page_size)# Pagespages,next_cursor=api.get_pages(query,start_cursor,page_size)# Create page in databaseapi.create_page('database_id',parent_id,title,properties,children,icon,cover)# Create page in parent pageapi.create_page('page_id',parent_id,title,properties,children,icon,cover)api.get_page(id)api.update_page(id,properties,archived)# Get page's block childrenblocks,next_cursor=api.get_block_children(id,start_cursor,page_size)api.append_block_children(id,children)Wrapper for relational databaseInteracting with Notion database as a relational database.Create databasefromnotiondbimportNotionDatabasefromnotiondb.fieldsimport*properties=[TitleField(name='Name'),RichTextField(name='Description'),CheckboxField(name='In stock'),SelectField(name='Food group',options=[{"name":"🥦Vegetable","color":"green"},{"name":"🍎Fruit","color":"red"},{"name":"💪Protein","color":"yellow"}]),NumberField(name='Price',format='dollar'),]# Create new databasedatabase=NotionDatabase(TOKEN,parent_id=NOTION_PARENT_PAGE_ID,title='Database title',properties=properties)# Or get existing databasedatabase=NotionDatabase(TOKEN,database_id=DATABASE_ID)Define document's structurefromnotiondbimportNotionModelfromnotiondb.fieldsimport*classTestModel(NotionModel):def__init__(self,database=None,id=None):super().__init__(database=database,id=id)self.name=TitleField('Name')self.description=RichTextField('Description')self.in_stock=CheckboxField('In stock')self.food_group=SelectField('Food group')self.price=NumberField('Price')Add a rowmodel=TestModel(database)model.name.value='Name'model.description.value='Description'model.in_stock.value=Truemodel.food_group.value='🥦Vegetable'model.price.value=2.33model.save()Update a row# Get a row from idmodel=TestModel.from_id(database,row_id)# Or from data retrieved by APImodel=TestModel.from_data(database,data)model.name.value='Name updated'model.save()Append block children to pagefromnotiondb.blockimport*children=[TableOfContentsBlock(),ParagraphBlock('paragraph 1'),ParagraphBlock('paragraph 2',link='https://example.com'),]model.append_children(children)Query databaseFilter & sorts referencecursor=TestModel.objects(database).get(filter=filter,sorts=sorts,limit=limit)foritemincursor:# do somethingGet row's data# Get row's block childrenchildren=model.get_children()# Parse to JSONdata=model.to_json(includes_children=True)Delete a rowmodel.delete()TestingCreate .env file in ./testsNOTION_TOKEN=
# Parent page id for testing
DEV_PAGE_NOTION_ID=Run testspython -m unittest
Package: notion-df
notion-df: Seamlessly Connecting Notion Database with Pandas DataFramePlease Note: This project is currently in pre-alpha stage. The code are not appropriately documented and tested. Please report any issues you find.Installationpipinstallnotion-dfUsageBefore starting, please follow the instructions tocreate a new integrationandadd it to your Notion page or database.We'll referInternal Integration Tokenas theapi_keybelow.Pandas-flavored APIs: Just need to add two additional lines of code:importnotion_dfnotion_df.pandas()#That's it!importpandasaspddf=pd.read_notion(page_url,api_key=api_key)df.to_notion(page_url)Download your Notion table as a pandas DataFrameimportnotion_dfdf=notion_df.download(notion_database_url,api_key=api_key)# Equivalent to: df = pd.read_notion(notion_database_url, api_key=api_key)df.head()Only downloading the first `nrows` from a databasedf=notion_df.download(notion_database_url,nrows=nrows)#e.g., 10What if your table has a relation column?df=notion_df.download(notion_database_url,resolve_relation_values=True)Theresolve_relation_values=Truewill automatically resolve the linking for all the relation columns whose target can be accessed by the current notion integration.In details, let's say the"test"column in df is a relation column in Notion.Whenresolve_relation_values=False, the return results for that column will be a list of UUIDs of the target page:['65e04f11-xxxx', 'b0ffcb4b-xxxx', ].Whenresolve_relation_values=True, the return results for that column will be a list of regular strings corresponding to the name column of the target pages:['page1', 'page2', ].Append a localdfto a Notion database:importnotion_dfnotion_df.upload(df,notion_database_url,title="page-title",api_key=api_key)# Equivalent to: df.to_notion(notion_database_url, title="page-title", api_key=api_key)Upload a localdfto a newly created database in a Notion page:importnotion_dfnotion_df.upload(df,notion_page_url,title="page-title",api_key=api_key)# Equivalent to: df.to_notion(notion_page_url, title="page-title", api_key=api_key)Tired of typingapi_key=api_keyeach time?importnotion_dfnotion_df.config(api_key=api_key)# Or set an environment variable `NOTION_API_KEY`df=notion_df.download(notion_database_url)notion_df.upload(df,notion_page_url,title="page-title")# Similarly in pandas APIs: df.to_notion(notion_page_url, title="page-title")TODOsAdd tests forloaduploadvalues.pyconfigs.pybase.pyBetter class organizations/namings for*Configsand*Values
Package: notion-df-extended
notion-df: Seamlessly Connecting Notion Database with Pandas DataFramePlease Note: This project is currently in pre-alpha stage. The code are not appropriately documented and tested. Please report any issues you find. Thanks!Installationpipinstallnotion-dfUsageBefore starting, please follow the instructions tocreate a new integrationandadd it to your Notion page or database.We'll referInternal Integration Tokenas theapi_keybelow.Pandas-flavored APIs: Just need to add two additional lines of code:importnotion_dfnotion_df.pandas()#That's it!page_url="paste your page url from Notion"api_key="paste your api key (internal integration key)"importpandasaspddf=pd.read_notion(page_url,api_key=api_key)df.to_notion(page_url,api_key=api_key)Download your Notion table as a pandas DataFrameimportnotion_dfdf=notion_df.download(notion_database_url,api_key=api_key)# Equivalent to: df = pd.read_notion(notion_database_url, api_key=api_key)df.head()Only downloading the first `nrows` from a databasedf=notion_df.download(notion_database_url,nrows=nrows)#e.g., 10What if your table has a relation column?df=notion_df.download(notion_database_url,resolve_relation_values=True)Theresolve_relation_values=Truewill automatically resolve the linking for all the relation columns whose target can be accessed by the current notion integration.In details, let's say the"test"column in df is a relation column in Notion.Whenresolve_relation_values=False, the return results for that column will be a list of UUIDs of the target page:['65e04f11-xxxx', 'b0ffcb4b-xxxx', ].Whenresolve_relation_values=True, the return results for that column will be a list of regular strings corresponding to the name column of the target pages:['page1', 'page2', ].Append a localdfto a Notion database:importnotion_dfnotion_df.upload(df,notion_database_url,title="page-title",api_key=api_key)# Equivalent to: df.to_notion(notion_database_url, title="page-title", api_key=api_key)Upload a localdfto a newly created database in a Notion page:importnotion_dfnotion_df.upload(df,notion_page_url,title="page-title",api_key=api_key)# Equivalent to: df.to_notion(notion_page_url, title="page-title", api_key=api_key)Tired of typingapi_key=api_keyeach time?importnotion_dfnotion_df.config(api_key=api_key)# Or set an environment variable `NOTION_API_KEY`df=notion_df.download(notion_database_url)notion_df.upload(df,notion_page_url,title="page-title")# Similarly in pandas APIs: df.to_notion(notion_page_url, title="page-title")DevelopmentClone the repo and install the dependencies:gitclonegit@github.com:lolipopshock/notion-df.gitcdnotion-df
pipinstall-e.[dev]How to run tests?NOTION_API_KEY="<the-api-key>"pytesttests/The tests are dependent on a list of notebooks, specified by the following environment variables:Environment VariableDescriptionNOTION_API_KEYThe API key for your Notion integrationNOTION_ROLLUP_DF-NOTION_FILES_DF-NOTION_FORMULA_DF-NOTION_RELATION_DF-NOTION_RELATION_TARGET_DF-NOTION_LONG_STRING_DF-NOTION_RICH_TEXT_DF-TODOsAdd tests forloaduploadvalues.pyconfigs.pybase.pyBetter class organizations/namings for*Configsand*Values
Package: notiondict
NotionDictNotionDict is a terminal dictionary application, you can use it to query the words from your own .mdx files,and the result will be shown by system notification. And it also supports uploading the result to Notion. You also can use it to upload highlight text to Notion. The best practice is to bind a shortcut to the app, then you can easily query the dict and highlight text anywhere.What NotionDict can do?Query the selected word and show the result by system notification, at the same time, the word will be saved to your Notion database.Highlight the selected text, and sync the selected text to your Notion database, the title of the acitve window will be sent to Notion as well. So you can get the highlight text of one pdf in one Notion page.The two functions are sepreate functions, you can use only one of them or both.PreparationCreate two databases,  one for saving queried words, the other one for saving highlight texts.The sturcture of vocabulary database:Name: Save the wordsSource: Save the source of the word (the active window title when you query the word)Date: Query dateThe sturcture of highlights database:Name: The page name(the active window title when you save the highlight), highlights from same webpage/app will be saved in same notion page.Date: Save dateYou need a .MDX dictionary file to query the word, find the .MDX dictionary you perfer then put it path into config file or env variables.Installationpip install notiondictUsageUsage:
notiondict dict <word> [--config <file-path>]
notiondict highlight <text> [--config <file-path>]
notiondict -h | --help

Options:
--config <file-path>  your own config file
--help -h  show helpExamplesnotiondict dict book --config /home/username/config.yml
notiondict highlight "This is a highlight"Contents of requirements.txtdocopt==0.6.2
pyclip==0.6.0
PyYAML==6.0
readmdict==0.1.1
requests==2.28.1
setuptools==63.0.0
urllib3==1.26.12Config fileYour need to save your Notion database id and Notion API Key in env variables or config file:For env variables:NOTION_HIGHLIGHT_DATABASE: Your_Notion_Database_Page_ID
NOTION_VOCABULARY_DATABASE: Your_Notion_Database_Page_ID
DICT_PATH: Your_Dict_Path
NOTION_API_KEY: Your_Notion_API_KEYFor config file:There is a config file example in the repo, attach the config file by this way when you run NotionDict:notiondict dict book --config /home/username/config.ymlBest practiceFor Linux:Use xsel to pass the selected text to NotionDictnotiondict dict "`xsel`"For MacOS:You can create a Shortcut to pass the acitve action to terminal.
Package: notiondl
NotionDLDesigned to simplify the process of exporting content from Notion. It provides an interface to configure, trigger, and download content exports from Notion. The class supports exporting content in various formats (Markdown, HTML, PDF) and also allows users to choose the scope of the export (current view vs. all content).FeaturesExport content inMarkdown,HTML, orPDFformat.Configure the scope of your export:current vieworall content.Option to include or exclude files in the export.Flatten the file tree structure upon export.Export multiple pages concurrently for faster processing.Monitor export progress with a progress bar.Automatically unpack zipped export files.InstallationpipinstallnotiondlUsageCLIpython-mnotiondl<PAGE_ID>-t<EXPORT_TYPE>--no-file-vAvaialbe OptionsArgumentDescriptionPAGE_ID(required)The ID of the Notion page you want to export. Separate multiple pages with commas.-d,--export-dirThe directory to export the page to. Defaults to the current directory.-t,--export-typeThe type of file to export. Defaults to HTML.-l,--no-fileDo not export files attached to the page. Defaults to False.-k,-keep-structureKeep the page hierarchy when exporting. Defaults to False.-s,--single-pageDo not export child pages. Defaults to False.-w,--rewriteDo not create date-formated folders for each export. Defaults to False.-v,--verboseWhether to print verbose output. Defaults to False.-c,--current-viewThe type of view to export. Defaults to the currentView.You can set whetherNOTION_TOKEN_V2andNOTION_FILE_TOKENenvironment variables or providing these as CLI arguments.--token-v2The token_v2 cookie value from your Notion session.--file-tokenThe file-token cookie value from your Notion session.Pythonimportnotiondlexporter=notiondl.NotionExporter(token_v2="<TOKEN>",file_token="<FILE_TOKEN>",pages={"index.html":"<PAGE_ID>"},export_directory="test",flatten_export_file_tree=True,export_type=notiondl.ExportType.HTML,current_view_export_type=notiondl.ViewExportType.CURRENT_VIEW,include_files=True,recursive=True,rewrite=True,)exporter.export()RequirementsIn case of CLI, you have to setNOTION_TOKEN_V2andNOTION_FILE_TOKENenvironment variables.
You will need to get thetoken_v2andfile_tokenvalues from your Notion cookies. Thepagesdictionary should contain pairs ofpage_name: page_idfor each page you want to export.page_namecan be anything and would be used for the final downloaded file name.Needed CookiesTo export anything from Notion, one needs to authenticate oneself with some
Cookies (like a browser would). These cookies are calledtoken_v2andfile_token. They are set on all requests of a logged in user when using the
Notion web-app.How to retrieve the Cookies?Go tonotion.so.Log in with your account.Open the developer tools of your browser, open Application > Storage > Cookies
(Chrome); Storage tab (Firefox).Copy the value of the Cookies calledtoken_v2andfile_tokenand paste
them somewhere safe.⚠️ If you don't findfile_token, you need to have at least had exported a file manually once.Those cookies have a1 year validity, so you don't need to do this often.LicenseMITAcknowledgementhttps://github.com/Strvm/python-notion-exporter
Package: notion-export-enhancer
Notion Export EnhancerTakes aNotion.soexport .zip and enhances it by:Removing all Notion IDs from the end of folders and filesAdds Unicode Emoji to start of folder/file names if it was in your Notion notesRetruncates note titles to 200 characters instead of 50Applies Notion's modification time to the file data itselfMoves root md files into the folder with their name, giving them a name like!index.mdinstead so they sort to the top.TODO:Remove empty notes (ones with only links)?Rewrite csv + md tables into md tables where appropriate?.exe instead of .py?Image captions should become MD alt image text, not a separate paragraphWould require exporting everything ourselves, paragraph after image is ambiguousSupports Python 3.6+Usage from CLIExport your notion workspaceYou can export a single workspace fromSettings > [Workspace] Settings > Export Content > Export all workspace contentChoose export option"Markdown & CSV"pip install notion_export_enhancerThen run likepython -m notion_export_enhancer [token_v2] [path_to_zip]token_v2is your Notion.so token, which can be obtained by inspecting your browser cookies on a logged-in (non-guest) session on Notion.soThere are also some configuration options:--output-path: Optionally set an output path, otherwise uses the current working directory--remove-title: Removes the title that Notion adds. H1s at the top of every file (default false)--rewrite-paths: Rewrite the paths in the Markdown files themselves to match file renaming (default true)ContributingSeeCONTRIBUTING.md