Skip to content

Latest commit

 

History

History
80 lines (76 loc) · 3.13 KB

README.md

File metadata and controls

80 lines (76 loc) · 3.13 KB

notion-currency-auto-update

european-union-1493894_1280

Docker Notion

Auto update currency exchange rate for Notion

Installation

By Python

Required packages

  1. requests
  2. notion-client
  3. cachetools

Run the below command to install
pip install requests notion-client cachetools

Optional packages

  1. python-dotenv
    • This package is use to load environment variables from .env.
      If you don't intend to use .env file, then this package is not required.

Run the below command to install
pip install python-dotenv

By Docker

Docker hub repo

Build locally

docker build .

Pull image

docker pull smarttommyau/notion-currency-auto-update

Usage

  1. Setup and Run Environment
  2. Connect Notion

By python

  1. Get an internal integration token

    Use Notion's Getting Started Guide to get set up to use Notion's API.

  2. Set the NOTION_TOKEN environment variable by setting it in .env or manually
  3. Now, run python main.py to run the program

By Docker

Simply Run docker run smarttommyau/notion-currency-auto-update

--env-file .env to load .env file -d to run in background

Setup Notion

  • First, connect the integration to the database by add connection
  • Then, follow the below instructions

You may also refer to this TEMPLATE

Ways To Use(Formula)

This way all rows in this column will be the same

  1. Create a new column in type of formula
  2. Naming scheme ExRTV currencyA>CurrencyB AnyName
  • ExRTV is a required prefix
  • CurrencyA: From this currency
  • CurrencyB: target currency
  • AnyName: whatever you like

Way To Use(Select with Number)

  1. Create 2 new columns one is a select and one is a number

Not multi-select!!

  1. For the select, Naming Scheme: ExRTT AnyName
  • ExRTT is a required prefix
  • AnyName: whatever you like
  1. For the number, Naming Scheme: ExRTV AnyName
  • ExRTV is a required prefix
  • AnyName: whatever you like
  1. For any row, set the select to in format of CurrencyA>CurrencyB
  • CurrencyA: From this currency
  • CurrencyB: target currency
  1. Then, the ExRTV field will be auto update

Future improvement

  • use a currency api that refresh more frequently
  • Host the public integration version

Note

It is normal that the update is not instantaneously due to indexing time and limited acess rate of the notion api.

Acknowledge