Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Oppdaterer fra master repo #7

Open
wants to merge 53 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
da81af6
Merge pull request #12 from yonyonson/master
steoj Mar 3, 2020
cfe30d9
Update README.md
stenjo Jul 29, 2020
ceb7ad2
Fixed error on credit card having interest date in the future
stenjo Oct 6, 2020
5ca3dd7
Fixed future date again
stenjo Oct 6, 2020
b3e9956
Added logging in sync_accounts
stenjo Oct 12, 2020
44907a2
Added python version info in log
stenjo Oct 12, 2020
74e992b
Updated logging info
stenjo Oct 12, 2020
2a6f7c3
Updated logging
stenjo Oct 12, 2020
4d85bc2
Cleanup
stenjo Oct 12, 2020
014a14e
Removed enddate on request to SBanken
stenjo Dec 28, 2020
d7e9a83
Update README.md
stenjo Jan 24, 2021
ebbd942
Added tests and updated getPayee to handle short text. Fixes #20
stenjo Feb 14, 2021
ab2869b
Updated documentation and references. Closes #18
stenjo Feb 14, 2021
fd8a115
Fixes typo in readme
stenjo Feb 14, 2021
2db6228
Moved sync length to the api_settings file
stenjo Feb 14, 2021
1e18e4b
First shot at update with refactoring and tests
stenjo May 18, 2021
964977f
Forgot the new Ynab class
stenjo May 18, 2021
b445a71
Create python-app.yml
stenjo May 19, 2021
e1b8dfb
Merge pull request #25 from stenjo/stenjo-patch-1
stenjo May 19, 2021
4dd95be
Merge branch 'master' of github.com:stenjo/SbankenToYNAB into feature…
stenjo May 19, 2021
b1287d8
Updated helpers and test files
stenjo May 19, 2021
dd55b84
Moved testdata to separate folder
stenjo May 19, 2021
e6d9ef5
Adding service option of sync
stenjo May 21, 2021
fc541eb
Merge pull request #24 from stenjo/feature/Major_updates
stenjo May 30, 2021
66b5b54
Update README.md
stenjo Jun 9, 2021
217bc2b
Added tests and fixed getTransactionsForYear due to 500 error on API
stenjo Jun 22, 2021
93b2058
Adding more helper tests
stenjo Jun 22, 2021
70fefcd
Do not include end date if it is today
andersthorsen Aug 4, 2021
c86074f
Merge pull request #30 from andersthorsen/feature/Major_updates
stenjo Aug 15, 2021
ba101e8
Adding codecov to project
stenjo Oct 13, 2021
ffaa9da
Updated workflow
stenjo Oct 13, 2021
484acfd
Fixing workflow file
stenjo Oct 13, 2021
e0c8a32
Fixed workflow file
stenjo Oct 13, 2021
1f464fb
Fixed
stenjo Oct 13, 2021
521121f
Merge pull request #29 from stenjo/feature/Major_updates
stenjo Oct 13, 2021
bf2c65c
Updated test file
stenjo Oct 13, 2021
c1e091b
Updating gitignore
stenjo Oct 13, 2021
7384551
Merge pull request #31 from stenjo/feature/Major_updates
stenjo Oct 13, 2021
32790f8
Create codecov.yml
stenjo Oct 13, 2021
dcc577e
Update README.md
stenjo Oct 13, 2021
5ff0471
Moved to auto-generated ynab_api
stenjo Jan 16, 2022
2ac7713
Fixing gitignore and adding testfile
stenjo Jan 16, 2022
9496e92
Merge branch 'master' of github.com:stenjo/SbankenToYNAB into ynabmodel
stenjo Jan 16, 2022
88e216a
Fixing Transaciton method
stenjo Jan 16, 2022
d9eb1d8
Adding account name to call
stenjo Jan 16, 2022
76c273c
Fixing date type
stenjo Jan 16, 2022
98ee0ff
Converted from datetime to date
stenjo Jan 16, 2022
c3c9ed0
Removing wrong import
stenjo Jan 16, 2022
df766e0
Lowercasing colours
stenjo Jan 16, 2022
672c705
Fixed wrong save structure
stenjo Jan 16, 2022
ce8d954
Fixed update transaction
stenjo Jan 16, 2022
195e198
Forgot import define
stenjo Jan 16, 2022
68b2e57
Merge pull request #34 from stenjo/ynabmodel
stenjo Feb 9, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions .github/workflows/python-app.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: Python application

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Set up Python 3.9
uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 pytest
pip install pytest-cov
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with pytest
run: |
pytest --cov=./ --cov-report=xml

- name: Codecov
uses: codecov/codecov-action@v2.1.0
with:
files: ./coverage.xml
14 changes: 10 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
personal_api_settings.py
.vscode/*
*.csv
ynab/models/__pycache__/*
ynab/ynab/__pycache__/*
ynab/__pycache__/*
*/*/*/__pycache__/*
*/__pycache__/*
__pycache__/*
api_settings.py
api_settings.py
sync_accounts.1.py
bash_script.sh
api_settings_temp.py
log/*
*.log
transacti*
statement*
workspace*
secret*
coverage.xml
.coverage
35 changes: 8 additions & 27 deletions GetPaymentsOneAccount.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,51 +2,32 @@
# https://support.youneedabudget.com/t/y72kjg

import csv
from Helpers import create_authenticated_http_session,get_accounts,get_standing_orders,get_payments,get_transactions,getTransactionDate,getPayee,getMemo, getOut, getIn, getPaymentsDate

def getAccount(http_session, customerId, accountNo):
accounts = get_accounts(
http_session,
customerId)

for account in accounts:
if account['accountNumber'] == accountNo:
return account

return None

from sbanken.Sbanken import Sbanken
from helpers.Helpers import getPaymentsDate, getAccounts

def main():
# enable_debug_logging()
import api_settings
import pprint

http_session = create_authenticated_http_session(api_settings.CLIENTID, api_settings.SECRET)
sbanken = Sbanken(api_settings.CUSTOMERID, api_settings.CLIENTID, api_settings.SECRET)

# customer_info = get_customer_information(http_session, api_settings.CUSTOMERID)
# customer_info = sbanken.GetCustomerInfo()
# pprint.pprint(customer_info)

# pprint.pprint(accounts)

# accountNo = input('What is the account number:')
accountNo = '97104496257'
account = getAccount(http_session, api_settings.CUSTOMERID, accountNo)
accountNo = input('What is the account number:')
account = getAccounts(sbanken, accountNo)

if account == None:
print('Account not found!')
exit(1)

# stOrders = get_standing_orders(
# http_session,
# api_settings.CUSTOMERID,
# account['accountId']
# )
# stOrders = sbanken.GetStandingOrders(account['accountId'])
# pprint.pprint(stOrders)

payments = get_payments(
http_session,
api_settings.CUSTOMERID,
account['accountId'])
payments = sbanken.GetPayments(account['accountId'])
# pprint.pprint(payments)

with open(account['name']+'_'+account['accountNumber']+'_Payments.csv', 'w', encoding='utf-8') as csvfile:
Expand Down
29 changes: 5 additions & 24 deletions GetStatementOneAccount.py
Original file line number Diff line number Diff line change
@@ -1,32 +1,17 @@
import csv
from Helpers import create_authenticated_http_session,get_accounts,get_transactions,getTransactionDate,getPayee,getMemo, getOut, getIn

def getAccount(http_session, customerId, accountNo):
accounts = get_accounts(
http_session,
customerId)

for account in accounts:
if account['accountNumber'] == accountNo:
return account

return None
from sbanken.Sbanken import Sbanken
from helpers.Helpers import getAccounts, getTransactionDate, getPayee, getMemo, getOut, getIn


def main():
# enable_debug_logging()
import api_settings
import pprint

http_session = create_authenticated_http_session(api_settings.CLIENTID, api_settings.SECRET)

# customer_info = get_customer_information(http_session, api_settings.CUSTOMERID)
# pprint.pprint(customer_info)

# pprint.pprint(accounts)
sbanken = Sbanken(api_settings.CUSTOMERID, api_settings.CLIENTID, api_settings.SECRET)

accountNo = input('What is the account number:')
account = getAccount(http_session, api_settings.CUSTOMERID, accountNo)
account = getAccounts(sbanken, accountNo)

if account == None:
print('Account not found!')
Expand All @@ -39,11 +24,7 @@ def main():
if months > 12:
months = 12

transactions = get_transactions(
http_session,
api_settings.CUSTOMERID,
account['accountId'],
months)
transactions = sbanken.GetTransactions(account['accountId'],months)
# pprint.pprint(transactions)

with open(account['name']+'_'+account['accountNumber']+'.csv', 'w', encoding='utf-8') as csvfile:
Expand Down
34 changes: 7 additions & 27 deletions GetStatementOneYear.py
Original file line number Diff line number Diff line change
@@ -1,50 +1,30 @@
import csv
from Helpers import get_transactions_year,create_authenticated_http_session,get_accounts,get_transactions,getTransactionDate,getPayee,getMemo, getOut, getIn

def getAccount(http_session, customerId, accountNo):
accounts = get_accounts(
http_session,
customerId)

for account in accounts:
if account['accountNumber'] == accountNo:
return account

return None

from sbanken.Sbanken import Sbanken
from helpers.Helpers import getAccounts, getTransactionDate,getPayee,getMemo, getOut, getIn

def main():
# enable_debug_logging()
import api_settings
import pprint

http_session = create_authenticated_http_session(api_settings.CLIENTID, api_settings.SECRET)

# customer_info = get_customer_information(http_session, api_settings.CUSTOMERID)
# pprint.pprint(customer_info)

# pprint.pprint(accounts)
sbanken = Sbanken(api_settings.CUSTOMERID, api_settings.CLIENTID, api_settings.SECRET)

accountNo = input('What is the account number:')
account = getAccount(http_session, api_settings.CUSTOMERID, accountNo)
account = getAccounts(sbanken, accountNo)

if account == None:
print('Account not found!')
exit(1)

year = input('What year?')
if year == '':
year = 2019
year = 2020

year = int(year)
if year < 2000:
year = 2019
year = 2020

transactions = get_transactions_year(
http_session,
api_settings.CUSTOMERID,
account['accountId'],
year)
transactions = sbanken.GetTransactionsForYear(account['accountId'],year)
# pprint.pprint(transactions)

with open(account['name']+'_'+account['accountNumber']+'.csv', 'w', encoding='utf-8') as csvfile:
Expand Down
16 changes: 5 additions & 11 deletions GetStatementsAllAccounts.py
Original file line number Diff line number Diff line change
@@ -1,26 +1,20 @@
import csv
from Helpers import *
from sbanken.Sbanken import Sbanken
from helpers.Helpers import getAccounts, getTransactionDate, getPayee, getMemo, getOut, getIn


def main():
# enable_debug_logging()
import api_settings
import pprint

http_session = create_authenticated_http_session(api_settings.CLIENTID, api_settings.SECRET)

accounts = get_accounts(
http_session,
api_settings.CUSTOMERID)
sbanken = Sbanken(api_settings.CUSTOMERID, api_settings.CLIENTID, api_settings.SECRET)

accounts = getAccounts(sbanken)

for account in accounts:

transactions = get_transactions(
http_session,
api_settings.CUSTOMERID,
account['accountId'],
1)
transactions = sbanken.GetTransactions(account['accountId'],1)
# pprint.pprint(transactions)

with open(account['name']+'_'+account['accountNumber']+'.csv', 'w', encoding='utf-8') as csvfile:
Expand Down
Loading