You need to have the following information:
- Amazon Account Email
- Amazon Account Password
- YNAB API Key (You can find how to get yours here)
- Payee name and ID to be used to patch the transactions on Amazon (see instructions below)
👉 You will also need Chrome or the Chromium webdriver installed.
Run the application with
python3 -m amazon_ynab --init
This will prompt you for the information. Data will be saved by default on the working
directory under .env/secrets.yml
. To change the location, and see other options, run
python3 -m amazon_ynab --help
To run the application after initialization, run
python3 -m amazon_ynab run
The options available for the run command are:
--headless
: Run the application in headless mode.--days-back [INT]
: Scrape the last [INT] days of transactions.--short-items
: Shorten names of items to fit in the YNAB table.--words-per-item [INT]
: Shorten names of items to fit in the YNAB table.
- On your YNAB budget, create a Payee for Amazon if you don't have one, or would like to use a new one.
- Go to the YNAB API and click on Authorize on the top right of the page. Input your YNAB API key in the field provided and click on Authorize.
- Scroll down to Payees, there should be a box
/budgets/{budget_id}/payees
. Select it, click onTry it out
, input your Budget ID onbudget_id
(you can also uselast-used
insted of the ID), and click onExecute
. - Scroll down to where it says
Response Body
. You should see a list of Payees. Look for the Amazon payee you want to use to save the reconciled transactions (overwriting the existing import payee for each transaction). Copy the ID and name and use them to initialize the application.
Sometimes the application fails to reconcile the transactions. In most cases this will
be because YNAB doesn't show the automatically imported transactions on the API without
some manual intervention. To fix this, you can go to your YNAB budget and for each of
your accounts click on View
at the top like the image below:
amazon:
password: <YOUR_AMAZON_PASSWORD>
username: <YOUR_AMAZON_EMAIL>
ynab:
token: <YOUR_YNAB_API_TOKEN>
amazon_payee_id: <YOUR_AMAZON_PAYEE_ID>
amazon_payee_name: <YOUR_AMAZON_PAYEE_NAME>
This project is heavily inspired from the following project:
This project was generated with
python-package-template