Coder Social home page Coder Social logo

vandaref / from_notion_to_habitica Goto Github PK

View Code? Open in Web Editor NEW
3.0 1.0 0.0 13 KB

Sync Tasks Between Notion and Habitica

Python 100.00%
habitica habitica-api habitica-api-v3 habitica-todo notion notion-api notion-automation notion-database notion-integrations tasks

from_notion_to_habitica's Introduction

Description

This project that will sync your Notion tasks to your Habitica account like creation tasks depending of their priority, their status (todo or complete) and close them in order to score in Habitica.

Installation

Download or clone the repo :

git clone https://github.com/vandaref/from_notion_to_habitica.git

Habitica

  1. Follow the instructions -> API_Habitica
  2. Get your Habitica API Token (XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXXX)
  3. Get your User ID (XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXXX)

Notion

  1. Create an integration -> Notion Integrations
  2. Get your integration token (secret_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX)
  3. Get your databaseId -> Get your databaseId
  1. Finally, in Notion, select the database that you want to sync with Habitica. Look for Connections (in settings) and choose the integration that you created.

Notion Requirements

Your tasks must follow those properties guidelines :

  • Property : Name

    • Name : Name
    • Type : title
  • Property : Priotity

    • Name : Priority
    • Type : select
    • Values : Low, Medium, High
  • Property : Status

    • Name : Status
    • Type : select
    • Values : Completed, etc. (one of then must be Completed)

In order to respect this part of the code :

for i in data['results']:
        name = i['properties']['Name']['title'][0]['text']['content']
        status = i['properties']['Status']['select']['name']
        priority = i['properties']['Priority']['select']['name']

Setup

Update the values in the script depending on your own API etc.

Usage

Start the script. I suggest to make a cron in order to execute the script few times in a day. (cf. How to create a cron)

python3 from_notion_to_habitica.py

Thanks to

Gauchy

from_notion_to_habitica's People

Contributors

vandaref avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

from_notion_to_habitica's Issues

Returns error for status

The code returns an error for status even though it's set up properly
Screenshot 2024-02-04 160118

==========================
Reading data

Reading Notion Data
200
Reading Habitica Data
200
Reading Habitica Done Data
200

Syncing Notion to Habitica

Traceback (most recent call last):
File "from_notion_to_habitica.py", line 206, in
syncNotionToHabitica()
File "from_notion_to_habitica.py", line 153, in syncNotionToHabitica
notionDoneList = getDoneListOfNotion()
File "from_notion_to_habitica.py", line 133, in getDoneListOfNotion
return getNotionList(notionDoneCondn)
File "from_notion_to_habitica.py", line 112, in getNotionList
status = i['properties']['Status']['select']['name']
KeyError: 'select'

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.