Giter VIP home page Giter VIP logo

kevinjalbert / notion-toolbox Goto Github PK

View Code? Open in Web Editor NEW
677.0 13.0 60.0 5.35 MB

This is a collection of Notion tools that work in tandem together.

Home Page: https://kevinjalbert.com/consolidating-notion-projects-into-notion-toolbox/

License: MIT License

Python 77.15% JavaScript 22.85%
alfred-workflow notion productivity organization ifttt alfred heroku ios ios-widget ios-shortcuts

notion-toolbox's Introduction

notion-toolbox's People

Contributors

kevinjalbert avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

notion-toolbox's Issues

Create a release process

I would like to have a solid release process in place for this project. Ideally, one where the Alfred Workflow file is present, that then requires slight modifications for an end-user.

Things to be wary of are the non-essential stuff in the workflow file (as well as avoid any config.json and tags.json files).

shortcut-append.jpeg & "Error: The data couldn't be read because it isn't in the correct format."

Hello!

Apologies if this is a very simple question.

On the shortcut-append.jpeg, how do you configure the Shortcut Input for the first "if" statement? When I create a new ios shortcut and use Shortcut Input as an input, it requires me to receive an input from a certain location. I can't find a method to connect Scriptable outputs as an input to the ios shortcut.
notion__

I haven't configured the shortcut-append, shortcut-delete and shortcut-refresh shortcuts yet, but after completing all the steps prior to that, I'm getting this error on my widget:
notion_

Any help with these two issues will be really appreciated!

Thank you for the script!!

Issue with get tasks

It seems it is related to #20, I executed get_tasks.py, and got below.

โฏ python3 get_tasks.py
Traceback (most recent call last):
  File "get_tasks.py", line 20, in <module>
    } for row in notion_api.tasks_database().default_query().execute()]
  File "/Volumes/Home/rickhan/Library/Python/3.7/lib/python/site-packages/notion/collection.py", line 223, in default_query
    return self.build_query(**self.get("query2", {}))
  File "/Volumes/Home/rickhan/Library/Python/3.7/lib/python/site-packages/notion/collection.py", line 219, in build_query
    collection=self.collection, collection_view=self, **kwargs
  File "/Volumes/Home/rickhan/Library/Python/3.7/lib/python/site-packages/notion/collection.py", line 301, in __init__
    assert not (aggregate and aggregations), "Use only one of `aggregate` or `aggregations` (old vs new format)"
AssertionError: Use only one of `aggregate` or `aggregations` (old vs new format)

This might be the reason why I have "Nothing" when I query the current task as well.

Issue getting the current day again

Referred to #6, and modified get_current_day.py however I have below logs from Alfred and shows cannot execute the program.

[18:51:26.467] Notion[Keyword] Processing complete
[18:51:26.468] Notion[Keyword] Passing output '' to Run Script
[18:51:29.138] Notion[Run Script] Processing complete
[18:51:29.143] Notion[Run Script] Passing output '[
  <BreadcrumbBlock (id='36f97810-d9b0-426d-b5df-d7ed567ca851')>,
  <ColumnListBlock (id='0c954592-6ff4-4493-a0a8-94a1e4a9f719')>,
  <Block (id='fcc601a0-1e67-4c6d-9f1b-02badfe66e18', type='copy_indicator')>,
  <Block (id='03495dbb-8a19-4816-90be-be0b4e1d93c0', type='copy_indicator')>,
  <Block (id='4e752f33-e04a-481a-9fb1-2fe21f1a6464', type='copy_indicator')>,
  <Block (id='c53bbad0-d99b-4909-9189-a6d7738bfee6', type='copy_indicator')>,
  <CollectionViewBlock (id='a40f3028-dcf1-418e-a5e4-41618d60299f', title='๐Ÿšฆ 2020 > Week 24 >  Lights', collection=<Collection (id='7917e894-6f7a-4936-b08a-54ae201bbf03')>)>,
  <TextBlock (id='c9e83947-0bc3-4eb5-b51f-ad2c8834e5bb', title="โฌ‡๏ธ Set table's filter to current week")>,
  <CollectionViewBlock (id='7de4e382-08cb-4c47-927a-c7604d0d46d9', title='๐Ÿ† Wins', collection=<Collection (id='305707c2-fef8-469e-b393-017bc290e72f')>)>,
  <SubheaderBlock (id='c7c4f972-f7fe-470a-a01e-fe66931d1509', title='Weekly Review')>,
  <SubsubheaderBlock (id='974d286c-e64b-45b6-b4d6-34ed0a416c9a', title='Lights (Aim for 5-6 *Yes,* adjust if outside of this)')>,
  <BulletedListBlock (id='84e5a9c2-3a85-4f12-ad98-6bf9393e9770', title='_Reflection_on_objectives_what_changes_for_next_week_')>,
  <SubsubheaderBlock (id='19a2e757-29ce-4cb6-985a-6348c583c143', title="RescueTime (make link to week's dashboard)")>,
  <TextBlock (id='c934e2af-6781-4ff6-accb-52f6805c2470', title='_Screenshot_of_dashboard_')>,
  <TextBlock (id='6c49a3c2-c584-4e69-aef1-7d0dda2a2c2f')>,
]
[
  <ColumnBlock (id='13a29fcd-c67a-4d4d-992c-07cc8177aad1')>,
  <ColumnBlock (id='361d528f-f6a0-4ef7-ad2a-8077827a5ce5')>,
]
[
  <SubheaderBlock (id='e4cc781c-c5a8-4e04-81ba-dca1d38e573f', title='Days')>,
  <PageBlock (id='936e658c-87ba-40df-977d-0b7795fd698f', title='June 7 (Sunday)')>,
  <PageBlock (id='7062af69-f86a-4c21-ad41-1cacccae6a3b', title='June 8  (Monday)')>,
  <PageBlock (id='21929fc5-77ad-42de-b0a0-d2b6e9256643', title='June 9 (Tuesday)')>,
  <PageBlock (id='73246907-752c-4e08-a895-8be9d2efb612', title='June 10 (Wednesday)')>,
  <PageBlock (id='1a445d6b-8fd2-420f-bc10-076c7de999b5', title='June 11 (Thursday)')>,
  <PageBlock (id='36b55dbb-0455-4cc4-9876-8866c6af98e4', title='June 12 (Friday)')>,
  <PageBlock (id='6bc70839-b6b0-47b7-a45a-0101f1a0229f', title='June 13 (Saturday)')>,
]
notion://www.notion.so/36b55dbb04554cc498768866c6af98e4
' to Filter
[18:51:29.160] Notion[Filter] Processing complete
[18:51:29.160] Notion[Filter] Passing output '[
  <BreadcrumbBlock (id='36f97810-d9b0-426d-b5df-d7ed567ca851')>,
  <ColumnListBlock (id='0c954592-6ff4-4493-a0a8-94a1e4a9f719')>,
  <Block (id='fcc601a0-1e67-4c6d-9f1b-02badfe66e18', type='copy_indicator')>,
  <Block (id='03495dbb-8a19-4816-90be-be0b4e1d93c0', type='copy_indicator')>,
  <Block (id='4e752f33-e04a-481a-9fb1-2fe21f1a6464', type='copy_indicator')>,
  <Block (id='c53bbad0-d99b-4909-9189-a6d7738bfee6', type='copy_indicator')>,
  <CollectionViewBlock (id='a40f3028-dcf1-418e-a5e4-41618d60299f', title='๐Ÿšฆ 2020 > Week 24 >  Lights', collection=<Collection (id='7917e894-6f7a-4936-b08a-54ae201bbf03')>)>,
  <TextBlock (id='c9e83947-0bc3-4eb5-b51f-ad2c8834e5bb', title="โฌ‡๏ธ Set table's filter to current week")>,
  <CollectionViewBlock (id='7de4e382-08cb-4c47-927a-c7604d0d46d9', title='๐Ÿ† Wins', collection=<Collection (id='305707c2-fef8-469e-b393-017bc290e72f')>)>,
  <SubheaderBlock (id='c7c4f972-f7fe-470a-a01e-fe66931d1509', title='Weekly Review')>,
  <SubsubheaderBlock (id='974d286c-e64b-45b6-b4d6-34ed0a416c9a', title='Lights (Aim for 5-6 *Yes,* adjust if outside of this)')>,
  <BulletedListBlock (id='84e5a9c2-3a85-4f12-ad98-6bf9393e9770', title='_Reflection_on_objectives_what_changes_for_next_week_')>,
  <SubsubheaderBlock (id='19a2e757-29ce-4cb6-985a-6348c583c143', title="RescueTime (make link to week's dashboard)")>,
  <TextBlock (id='c934e2af-6781-4ff6-accb-52f6805c2470', title='_Screenshot_of_dashboard_')>,
  <TextBlock (id='6c49a3c2-c584-4e69-aef1-7d0dda2a2c2f')>,
]
[
  <ColumnBlock (id='13a29fcd-c67a-4d4d-992c-07cc8177aad1')>,
  <ColumnBlock (id='361d528f-f6a0-4ef7-ad2a-8077827a5ce5')>,
]
[
  <SubheaderBlock (id='e4cc781c-c5a8-4e04-81ba-dca1d38e573f', title='Days')>,
  <PageBlock (id='936e658c-87ba-40df-977d-0b7795fd698f', title='June 7 (Sunday)')>,
  <PageBlock (id='7062af69-f86a-4c21-ad41-1cacccae6a3b', title='June 8  (Monday)')>,
  <PageBlock (id='21929fc5-77ad-42de-b0a0-d2b6e9256643', title='June 9 (Tuesday)')>,
  <PageBlock (id='73246907-752c-4e08-a895-8be9d2efb612', title='June 10 (Wednesday)')>,
  <PageBlock (id='1a445d6b-8fd2-420f-bc10-076c7de999b5', title='June 11 (Thursday)')>,
  <PageBlock (id='36b55dbb-0455-4cc4-9876-8866c6af98e4', title='June 12 (Friday)')>,
  <PageBlock (id='6bc70839-b6b0-47b7-a45a-0101f1a0229f', title='June 13 (Saturday)')>,
]
notion://www.notion.so/36b55dbb04554cc498768866c6af98e4
' to Transform
[18:51:29.163] Notion[Transform] Processing complete
[18:51:29.164] Notion[Transform] Passing output '[
  <BreadcrumbBlock (id='36f97810-d9b0-426d-b5df-d7ed567ca851')>,
  <ColumnListBlock (id='0c954592-6ff4-4493-a0a8-94a1e4a9f719')>,
  <Block (id='fcc601a0-1e67-4c6d-9f1b-02badfe66e18', type='copy_indicator')>,
  <Block (id='03495dbb-8a19-4816-90be-be0b4e1d93c0', type='copy_indicator')>,
  <Block (id='4e752f33-e04a-481a-9fb1-2fe21f1a6464', type='copy_indicator')>,
  <Block (id='c53bbad0-d99b-4909-9189-a6d7738bfee6', type='copy_indicator')>,
  <CollectionViewBlock (id='a40f3028-dcf1-418e-a5e4-41618d60299f', title='๐Ÿšฆ 2020 > Week 24 >  Lights', collection=<Collection (id='7917e894-6f7a-4936-b08a-54ae201bbf03')>)>,
  <TextBlock (id='c9e83947-0bc3-4eb5-b51f-ad2c8834e5bb', title="โฌ‡๏ธ Set table's filter to current week")>,
  <CollectionViewBlock (id='7de4e382-08cb-4c47-927a-c7604d0d46d9', title='๐Ÿ† Wins', collection=<Collection (id='305707c2-fef8-469e-b393-017bc290e72f')>)>,
  <SubheaderBlock (id='c7c4f972-f7fe-470a-a01e-fe66931d1509', title='Weekly Review')>,
  <SubsubheaderBlock (id='974d286c-e64b-45b6-b4d6-34ed0a416c9a', title='Lights (Aim for 5-6 *Yes,* adjust if outside of this)')>,
  <BulletedListBlock (id='84e5a9c2-3a85-4f12-ad98-6bf9393e9770', title='_Reflection_on_objectives_what_changes_for_next_week_')>,
  <SubsubheaderBlock (id='19a2e757-29ce-4cb6-985a-6348c583c143', title="RescueTime (make link to week's dashboard)")>,
  <TextBlock (id='c934e2af-6781-4ff6-accb-52f6805c2470', title='_Screenshot_of_dashboard_')>,
  <TextBlock (id='6c49a3c2-c584-4e69-aef1-7d0dda2a2c2f')>,
]
[
  <ColumnBlock (id='13a29fcd-c67a-4d4d-992c-07cc8177aad1')>,
  <ColumnBlock (id='361d528f-f6a0-4ef7-ad2a-8077827a5ce5')>,
]
[
  <SubheaderBlock (id='e4cc781c-c5a8-4e04-81ba-dca1d38e573f', title='Days')>,
  <PageBlock (id='936e658c-87ba-40df-977d-0b7795fd698f', title='June 7 (Sunday)')>,
  <PageBlock (id='7062af69-f86a-4c21-ad41-1cacccae6a3b', title='June 8  (Monday)')>,
  <PageBlock (id='21929fc5-77ad-42de-b0a0-d2b6e9256643', title='June 9 (Tuesday)')>,
  <PageBlock (id='73246907-752c-4e08-a895-8be9d2efb612', title='June 10 (Wednesday)')>,
  <PageBlock (id='1a445d6b-8fd2-420f-bc10-076c7de999b5', title='June 11 (Thursday)')>,
  <PageBlock (id='36b55dbb-0455-4cc4-9876-8866c6af98e4', title='June 12 (Friday)')>,
  <PageBlock (id='6bc70839-b6b0-47b7-a45a-0101f1a0229f', title='June 13 (Saturday)')>,
]
notion://www.notion.so/36b55dbb04554cc498768866c6af98e4' to Open URL
[18:51:29.168] Notion[Run Script] Passing output '[
  <BreadcrumbBlock (id='36f97810-d9b0-426d-b5df-d7ed567ca851')>,
  <ColumnListBlock (id='0c954592-6ff4-4493-a0a8-94a1e4a9f719')>,
  <Block (id='fcc601a0-1e67-4c6d-9f1b-02badfe66e18', type='copy_indicator')>,
  <Block (id='03495dbb-8a19-4816-90be-be0b4e1d93c0', type='copy_indicator')>,
  <Block (id='4e752f33-e04a-481a-9fb1-2fe21f1a6464', type='copy_indicator')>,
  <Block (id='c53bbad0-d99b-4909-9189-a6d7738bfee6', type='copy_indicator')>,
  <CollectionViewBlock (id='a40f3028-dcf1-418e-a5e4-41618d60299f', title='๐Ÿšฆ 2020 > Week 24 >  Lights', collection=<Collection (id='7917e894-6f7a-4936-b08a-54ae201bbf03')>)>,
  <TextBlock (id='c9e83947-0bc3-4eb5-b51f-ad2c8834e5bb', title="โฌ‡๏ธ Set table's filter to current week")>,
  <CollectionViewBlock (id='7de4e382-08cb-4c47-927a-c7604d0d46d9', title='๐Ÿ† Wins', collection=<Collection (id='305707c2-fef8-469e-b393-017bc290e72f')>)>,
  <SubheaderBlock (id='c7c4f972-f7fe-470a-a01e-fe66931d1509', title='Weekly Review')>,
  <SubsubheaderBlock (id='974d286c-e64b-45b6-b4d6-34ed0a416c9a', title='Lights (Aim for 5-6 *Yes,* adjust if outside of this)')>,
  <BulletedListBlock (id='84e5a9c2-3a85-4f12-ad98-6bf9393e9770', title='_Reflection_on_objectives_what_changes_for_next_week_')>,
  <SubsubheaderBlock (id='19a2e757-29ce-4cb6-985a-6348c583c143', title="RescueTime (make link to week's dashboard)")>,
  <TextBlock (id='c934e2af-6781-4ff6-accb-52f6805c2470', title='_Screenshot_of_dashboard_')>,
  <TextBlock (id='6c49a3c2-c584-4e69-aef1-7d0dda2a2c2f')>,
]
[
  <ColumnBlock (id='13a29fcd-c67a-4d4d-992c-07cc8177aad1')>,
  <ColumnBlock (id='361d528f-f6a0-4ef7-ad2a-8077827a5ce5')>,
]
[
  <SubheaderBlock (id='e4cc781c-c5a8-4e04-81ba-dca1d38e573f', title='Days')>,
  <PageBlock (id='936e658c-87ba-40df-977d-0b7795fd698f', title='June 7 (Sunday)')>,
  <PageBlock (id='7062af69-f86a-4c21-ad41-1cacccae6a3b', title='June 8  (Monday)')>,
  <PageBlock (id='21929fc5-77ad-42de-b0a0-d2b6e9256643', title='June 9 (Tuesday)')>,
  <PageBlock (id='73246907-752c-4e08-a895-8be9d2efb612', title='June 10 (Wednesday)')>,
  <PageBlock (id='1a445d6b-8fd2-420f-bc10-076c7de999b5', title='June 11 (Thursday)')>,
  <PageBlock (id='36b55dbb-0455-4cc4-9876-8866c6af98e4', title='June 12 (Friday)')>,
  <PageBlock (id='6bc70839-b6b0-47b7-a45a-0101f1a0229f', title='June 13 (Saturday)')>,
]
notion://www.notion.so/36b55dbb04554cc498768866c6af98e4
' to Call External Trigger
[18:51:29.173] Notion[External] Processing complete
[18:51:29.173] Notion[External] Passing output '[
  <BreadcrumbBlock (id='36f97810-d9b0-426d-b5df-d7ed567ca851')>,
  <ColumnListBlock (id='0c954592-6ff4-4493-a0a8-94a1e4a9f719')>,
  <Block (id='fcc601a0-1e67-4c6d-9f1b-02badfe66e18', type='copy_indicator')>,
  <Block (id='03495dbb-8a19-4816-90be-be0b4e1d93c0', type='copy_indicator')>,
  <Block (id='4e752f33-e04a-481a-9fb1-2fe21f1a6464', type='copy_indicator')>,
  <Block (id='c53bbad0-d99b-4909-9189-a6d7738bfee6', type='copy_indicator')>,
  <CollectionViewBlock (id='a40f3028-dcf1-418e-a5e4-41618d60299f', title='๐Ÿšฆ 2020 > Week 24 >  Lights', collection=<Collection (id='7917e894-6f7a-4936-b08a-54ae201bbf03')>)>,
  <TextBlock (id='c9e83947-0bc3-4eb5-b51f-ad2c8834e5bb', title="โฌ‡๏ธ Set table's filter to current week")>,
  <CollectionViewBlock (id='7de4e382-08cb-4c47-927a-c7604d0d46d9', title='๐Ÿ† Wins', collection=<Collection (id='305707c2-fef8-469e-b393-017bc290e72f')>)>,
  <SubheaderBlock (id='c7c4f972-f7fe-470a-a01e-fe66931d1509', title='Weekly Review')>,
  <SubsubheaderBlock (id='974d286c-e64b-45b6-b4d6-34ed0a416c9a', title='Lights (Aim for 5-6 *Yes,* adjust if outside of this)')>,
  <BulletedListBlock (id='84e5a9c2-3a85-4f12-ad98-6bf9393e9770', title='_Reflection_on_objectives_what_changes_for_next_week_')>,
  <SubsubheaderBlock (id='19a2e757-29ce-4cb6-985a-6348c583c143', title="RescueTime (make link to week's dashboard)")>,
  <TextBlock (id='c934e2af-6781-4ff6-accb-52f6805c2470', title='_Screenshot_of_dashboard_')>,
  <TextBlock (id='6c49a3c2-c584-4e69-aef1-7d0dda2a2c2f')>,
]
[
  <ColumnBlock (id='13a29fcd-c67a-4d4d-992c-07cc8177aad1')>,
  <ColumnBlock (id='361d528f-f6a0-4ef7-ad2a-8077827a5ce5')>,
]
[
  <SubheaderBlock (id='e4cc781c-c5a8-4e04-81ba-dca1d38e573f', title='Days')>,
  <PageBlock (id='936e658c-87ba-40df-977d-0b7795fd698f', title='June 7 (Sunday)')>,
  <PageBlock (id='7062af69-f86a-4c21-ad41-1cacccae6a3b', title='June 8  (Monday)')>,
  <PageBlock (id='21929fc5-77ad-42de-b0a0-d2b6e9256643', title='June 9 (Tuesday)')>,
  <PageBlock (id='73246907-752c-4e08-a895-8be9d2efb612', title='June 10 (Wednesday)')>,
  <PageBlock (id='1a445d6b-8fd2-420f-bc10-076c7de999b5', title='June 11 (Thursday)')>,
  <PageBlock (id='36b55dbb-0455-4cc4-9876-8866c6af98e4', title='June 12 (Friday)')>,
  <PageBlock (id='6bc70839-b6b0-47b7-a45a-0101f1a0229f', title='June 13 (Saturday)')>,
]
notion://www.notion.so/36b55dbb04554cc498768866c6af98e4
' to Filter

It seems it is passing the entire outputs as a variable, not the browseable URL only.

notion_api.py cannot find what it needs to import

/src ๎‚ฐ python3 add_task.py Traceback (most recent call last): File "add_task.py", line 7, in <module> from notion_api import notion_api File "/Users/er046256/Library/Application Support/Alfred/Alfred.alfredpreferences/workflows/user.workflow.E09BB44C-123F-4ED3-9D1F-6CCE03F76523/src/notion_api.py", line 1, in <module> from notionscripts.notion_api import NotionApi ModuleNotFoundError: No module named 'notionscripts'

I followed the instructions on the readme and tried to use the workflow. I noticed it was not working even though I had my cookie and paths in the config file. I tried to just run one of the python scripts and it cannot find the scripts in the shared directory? I do not recall copying those over. I'm not sure where to copy them since we are also supposed to have copied over the contents of the alfred directory.

Issue getting the current day

Everything is working as expected, except I can't get the current day. I followed the tutorial and have my days underneath the current week. I also experimented by changing the array index, but ColumnBlocks and Blocks are not iterable:

image

I assume this has to do with this:
image

My current Notion looks like this:
image

I'm a first-time Notion user and don't quite understand the structure yet. I read through the Notion API wrapper, but can't seem to get it to work. Getting the current week, however, works like a charm.

Add a blocks/<block_id>/children endpoint

This new endpoint will make it so the blocks/<block_id> one doesn't have to concatenate all the children's content and instead we can use the new endpoint to get that information.

GET /blocks/<block_id>/children

Should return something like:

[
 {"id": "first block_id", "title": "first block_text"},
 {"id": "second block_id", "title": "second block_text"}
]

Issue with Bitbar

I have below errors from bitbar.

Traceback (most recent call last):
  File "/Volumes/Home/rickhan/notion-toolbox/bitbar/get_current_tasks.py", line 17, in <module>
    message = "Working on Nothing | href=%s" % app_url(api.current_day().get_browseable_url())
  File "/Volumes/Home/rickhan/Library/Python/3.7/lib/python/site-packages/cachetools/__init__.py", line 46, in wrapper
    v = func(*args, **kwargs)
  File "/Volumes/Home/rickhan/notion-toolbox/shared/notionscripts/notion_api.py", line 65, in current_day
    day_name = current_date.strftime(self.config.custom_day_format())
TypeError: strftime() argument 1 must be str, not None

ModuleNotFoundError: No module named 'notionscripts'

I got the following error after run any command with alfred:

[11:28:32.016] ERROR: Notion[Run Script] Traceback (most recent call last):
File "/Users/172100/Library/Application Support/Alfred/Alfred.alfredpreferences/workflows/user.workflow.EF87D811-021C-45B9-A871-CE8263AE312E/src/add_note.py", line 6, in
from notion_api import notion_api
File "/Users/172100/Library/Application Support/Alfred/Alfred.alfredpreferences/workflows/user.workflow.EF87D811-021C-45B9-A871-CE8263AE312E/src/notion_api.py", line 1, in
from notionscripts.notion_api import NotionApi
ModuleNotFoundError: No module named 'notionscripts'

I checked all the files are in the folder and when I did: pip3 install -r requirements.txt I got:

Requirement already satisfied: cachetools==3.1.0 in /usr/local/anaconda3/lib/python3.7/site-packages (from -r requirements.txt (line 1)) (3.1.0)
Requirement already satisfied: notion==0.0.21 in /usr/local/anaconda3/lib/python3.7/site-packages (from -r requirements.txt (line 2)) (0.0.21)
Requirement already satisfied: flake8==3.7.7 in /usr/local/anaconda3/lib/python3.7/site-packages (from -r requirements.txt (line 3)) (3.7.7)
Requirement already satisfied: notion-scripts from git+git://github.com/kevinjalbert/[email protected]#egg=notion-scripts in /usr/local/anaconda3/lib/python3.7/site-packages (from -r requirements.txt (line 4)) (0.1.0)
Requirement already satisfied: commonmark in /usr/local/anaconda3/lib/python3.7/site-packages (from notion==0.0.21->-r requirements.txt (line 2)) (0.9.0)
Requirement already satisfied: requests in /usr/local/anaconda3/lib/python3.7/site-packages (from notion==0.0.21->-r requirements.txt (line 2)) (2.21.0)
Requirement already satisfied: dictdiffer in /usr/local/anaconda3/lib/python3.7/site-packages (from notion==0.0.21->-r requirements.txt (line 2)) (0.8.0)
Requirement already satisfied: tzlocal in /usr/local/anaconda3/lib/python3.7/site-packages (from notion==0.0.21->-r requirements.txt (line 2)) (2.0.0)
Requirement already satisfied: cached-property in /usr/local/anaconda3/lib/python3.7/site-packages (from notion==0.0.21->-r requirements.txt (line 2)) (1.5.1)
Requirement already satisfied: python-slugify in /usr/local/anaconda3/lib/python3.7/site-packages (from notion==0.0.21->-r requirements.txt (line 2)) (3.0.4)
Requirement already satisfied: bs4 in /usr/local/anaconda3/lib/python3.7/site-packages (from notion==0.0.21->-r requirements.txt (line 2)) (0.0.1)
Requirement already satisfied: entrypoints<0.4.0,>=0.3.0 in /usr/local/anaconda3/lib/python3.7/site-packages (from flake8==3.7.7->-r requirements.txt (line 3)) (0.3)
Requirement already satisfied: pyflakes<2.2.0,>=2.1.0 in /usr/local/anaconda3/lib/python3.7/site-packages (from flake8==3.7.7->-r requirements.txt (line 3)) (2.1.1)
Requirement already satisfied: mccabe<0.7.0,>=0.6.0 in /usr/local/anaconda3/lib/python3.7/site-packages (from flake8==3.7.7->-r requirements.txt (line 3)) (0.6.1)
Requirement already satisfied: pycodestyle<2.6.0,>=2.5.0 in /usr/local/anaconda3/lib/python3.7/site-packages (from flake8==3.7.7->-r requirements.txt (line 3)) (2.5.0)
Requirement already satisfied: future in /usr/local/anaconda3/lib/python3.7/site-packages (from commonmark->notion==0.0.21->-r requirements.txt (line 2)) (0.17.1)
Requirement already satisfied: idna<2.9,>=2.5 in /usr/local/anaconda3/lib/python3.7/site-packages (from requests->notion==0.0.21->-r requirements.txt (line 2)) (2.8)
Requirement already satisfied: urllib3<1.25,>=1.21.1 in /usr/local/anaconda3/lib/python3.7/site-packages (from requests->notion==0.0.21->-r requirements.txt (line 2)) (1.24.1)
Requirement already satisfied: chardet<3.1.0,>=3.0.2 in /usr/local/anaconda3/lib/python3.7/site-packages (from requests->notion==0.0.21->-r requirements.txt (line 2)) (3.0.4)
Requirement already satisfied: certifi>=2017.4.17 in /usr/local/anaconda3/lib/python3.7/site-packages (from requests->notion==0.0.21->-r requirements.txt (line 2)) (2019.3.9)
Requirement already satisfied: pytz in /usr/local/anaconda3/lib/python3.7/site-packages (from tzlocal->notion==0.0.21->-r requirements.txt (line 2)) (2018.9)
Requirement already satisfied: text-unidecode>=1.3 in /usr/local/anaconda3/lib/python3.7/site-packages (from python-slugify->notion==0.0.21->-r requirements.txt (line 2)) (1.3)
Requirement already satisfied: beautifulsoup4 in /usr/local/anaconda3/lib/python3.7/site-packages (from bs4->notion==0.0.21->-r requirements.txt (line 2)) (4.7.1)
Requirement already satisfied: soupsieve>=1.2 in /usr/local/anaconda3/lib/python3.7/site-packages (from beautifulsoup4->bs4->notion==0.0.21->-r requirements.txt (line 2)) (1.8)

python --version
Python 3.7.3

Trying to deploy heroku app fails

Getting error on deploying heroku app. Here's the log:

-----> Python app detected

 !     Python has released a security update! Please consider upgrading to python-3.7.9

       Learn More: https://devcenter.heroku.com/articles/python-runtimes

-----> Installing python-3.7.6

-----> Installing pip 20.1.1, setuptools 47.1.1 and wheel 0.34.2

-----> Installing SQLite3

-----> Installing requirements with pip

       Collecting git+https://github.com/kevinjalbert/notion-py.git (from -r /tmp/build_18d77bd7_/./server/requirements.txt (line 2))

         Cloning https://github.com/kevinjalbert/notion-py.git to /tmp/pip-req-build-vgx1cmtm

         Running command git clone -q https://github.com/kevinjalbert/notion-py.git /tmp/pip-req-build-vgx1cmtm

           ERROR: Command errored out with exit status 1:

            command: /app/.heroku/python/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-req-build-vgx1cmtm/setup.py'"'"'; __file__='"'"'/tmp/pip-req-build-vgx1cmtm/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-18vvwrjj

                cwd: /tmp/pip-req-build-vgx1cmtm/

           Complete output (7 lines):

           Traceback (most recent call last):

             File "<string>", line 1, in <module>

             File "/tmp/pip-req-build-vgx1cmtm/setup.py", line 12, in <module>

               install_requires = [str(ir.req) for ir in reqs]

             File "/tmp/pip-req-build-vgx1cmtm/setup.py", line 12, in <listcomp>

               install_requires = [str(ir.req) for ir in reqs]

           AttributeError: 'ParsedRequirement' object has no attribute 'req'

           ----------------------------------------

       ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

 !     Push rejected, failed to compile Python app.

 !     Push failed

Issue when updating local tags

Hi,

I'm having an issue when trying to fetch the remote tags:

โฏ python3 src/update_tags.py
Traceback (most recent call last):
  File "src/update_tags.py", line 12, in <module>
    results = database.default_query().execute()
  File "/usr/local/lib/python3.7/site-packages/notion/collection.py", line 223, in default_query
    return self.build_query(**self.get("query2", {}))
  File "/usr/local/lib/python3.7/site-packages/notion/collection.py", line 219, in build_query
    collection=self.collection, collection_view=self, **kwargs
  File "/usr/local/lib/python3.7/site-packages/notion/collection.py", line 301, in __init__
    assert not (aggregate and aggregations), "Use only one of `aggregate` or `aggregations` (old vs new format)"
AssertionError: Use only one of `aggregate` or `aggregations` (old vs new format)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "src/update_tags.py", line 39, in <module>
    sys.stderr.write(e)
TypeError: write() argument must be str, not AssertionError
zsh: exit 1     python3 src/update_tags.py

Since the query is "query2" it must be using your notion-py repo which contains this patch, did the notion API change in the meantime?

Thanks!

Does not work with alfred (notionscripts module not found)

run python src/get_current_day.py and it seems to return the right outcome

python src/get_current_day.py
[
  <BreadcrumbBlock (id='b178de11-cf1a-41d0-a0ce-bc2cc153a9db')>,
  <ColumnListBlock (id='5dd988e2-9ad2-40b7-a35b-e904e8d49c28')>,
  <Block (id='09896a10-59e6-44f1-9236-1cbdad6a26ba', type='copy_indicator')>,
  <Block (id='4f76989c-c894-45dc-b4e0-e9b5a2944ec1', type='copy_indicator')>,
  <Block (id='731c695a-eec6-45e2-8f54-f300b2c5a976', type='copy_indicator')>,
  <Block (id='cee982cd-6fa7-453c-9e09-9316e7ab57c1', type='copy_indicator')>,
  <CollectionViewBlock (id='66aec8a1-2042-40d3-a1b0-87ef29ee1c77', title='2019 > Week 8 >  Lights', collection=<Collection (id='25010c71-5809-4b56-96b0-4a91a8a63fe3')>)>,
  <CollectionViewBlock (id='70a97d2e-447e-4f89-ba4d-6017f45dc7d0', title='Wins', collection=<Collection (id='cfc3190b-767e-4bc5-9494-1abf29f4bded')>)>,
  <SubheaderBlock (id='e3acb8ab-c73e-4087-b1b5-1ee5b040b8ff', title='Weekly Review')>,
  <SubsubheaderBlock (id='4c330765-5cf5-43d7-a1b7-bff341879215', title='Lights (Aim for 5-6 *Yes,* adjust if outside of this)')>,
  <BulletedListBlock (id='eeaab19e-b237-4891-ba27-0655c8ff800c', title='_Reflection_on_objectives_what_changes_for_next_week_')>,
  <SubsubheaderBlock (id='66be0070-3d57-49dc-97f7-e75f47b750f6', title='ScreenTime ')>,
  <TextBlock (id='2344efc3-6d25-4bdd-a65d-698a6dfe11bf', title='_Screenshot_of_ScreenTime_')>,
  <TextBlock (id='6aff26de-0c5a-4132-91a6-58c81424e04b')>,
]
[
  <ColumnBlock (id='a9d0d7ff-f341-4c2a-b4a9-c6c93c042440')>,
  <ColumnBlock (id='45b5b795-cbea-4b12-9c2b-db5c60b0b511')>,
]
[
  <SubheaderBlock (id='1a00f0b6-778c-4372-9979-62c6d6c9a1f3', title='Days')>,
  <PageBlock (id='705d2631-7ddf-4865-823a-a1f056cbcd2a', title='February 16 (Sunday)')>,
  <PageBlock (id='0a907b46-b003-431e-8089-02e530e04fd2', title='February 17 (Monday)')>,
  <PageBlock (id='48db4933-3d98-4f81-b840-6a1a20378f92', title='February 18 (Tuesday)')>,
  <PageBlock (id='98be36a8-69d1-44aa-8aff-d0317eebb57b', title='February 19 (Wednesday)')>,
  <PageBlock (id='a39b3bb2-93a0-408e-b9bd-eba49be433fa', title='February 20 (Thursday)')>,
  <PageBlock (id='b14352f3-34e4-4a24-b535-b351f2e4016f', title='February 21 (Friday)')>,
  <PageBlock (id='3f52c760-baa9-4568-a118-1af81f6ecf5a', title='February 22 (Saturday)')>,
]
notion://98be36a869d144aa8affd0317eebb57b

but when I run Open Current Day in Alfred it failed, here it is the debug info:

[16:45:36.975] Notion[Keyword] Processing complete
[16:45:36.975] Notion[Keyword] Passing output '' to Run Script
[16:45:37.062] ERROR: Notion[Run Script] Traceback (most recent call last):
  File "/Users/ywen8/Library/Application Support/Alfred/Alfred.alfredpreferences/workflows/user.workflow.E529221C-0AAA-4528-AA8F-1D44DE9C2B2C/src/get_current_day.py", line 5, in <module>
    from notion_api import notion_api
  File "/Users/ywen8/Library/Application Support/Alfred/Alfred.alfredpreferences/workflows/user.workflow.E529221C-0AAA-4528-AA8F-1D44DE9C2B2C/src/notion_api.py", line 1, in <module>
    from notionscripts.notion_api import NotionApi
ModuleNotFoundError: No module named 'notionscripts'
[16:45:37.069] Notion[Run Script] Processing complete
[16:45:37.069] Notion[Run Script] Passing output '' to Filter
[16:45:37.070] Notion[Run Script] Passing output '' to Call External Trigger
[16:45:37.070] Notion[External] Processing complete
[16:45:37.070] Notion[External] Passing output '' to Filter
[16:45:37.071] Notion[Filter] Processing complete
[16:45:37.071] Notion[Filter] Passing output '' to Post Notification

Kevin, I appreciate your help.

Wishlist for Christmas

  1. Universal Peace on the Planet
  2. Understanding Quantum Mechanics
  3. A General-Purpose Alfred Workflow for Notion
    <3

`AttributeError: 'NoneType' object has no attribute 'children'` when run `python src/get_current_day.py`

@kevinjalbert hey kevin, I got the following error when run python3 src/get_current_day.py

python src/get_current_day.py
Traceback (most recent call last):
  File "src/get_current_day.py", line 10, in <module>
    print(notion_api.current_week().children)
  File "/Users/ywen8/.pyenv/versions/3.8.1/lib/python3.8/site-packages/cachetools/__init__.py", line 46, in wrapper
    v = func(*args, **kwargs)
  File "/Users/ywen8/.pyenv/versions/3.8.1/lib/python3.8/site-packages/notionscripts/notion_api.py", line 48, in current_week
    if week_page.title.startswith("Week " + week_number):
AttributeError: 'Block' object has no attribute 'title'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "src/get_current_day.py", line 16, in <module>
    sys.stderr.write(e)
TypeError: write() argument must be str, not AttributeError

Alfred Workflow Incomptaible With Alfred v3.8.5 [970]

Hey -- Love your work.

Got the scripts working with some tweaking -- but I was very curious how you rigged up the Alfred workflow.

Let me know what version Alfred your workflow is compatible with -- Would love to test out this integration.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.