rienafairefr / pynYNAB

a python client for the new YNAB
MIT License
138 stars 12 forks source link

AttributeError: 'nYnabClient_' object has no attribute 'sesssion' #56

Closed TheGeekAndI closed 6 years ago

TheGeekAndI commented 6 years ago

Hi,

I have downloaded the latest version of the package with pip install and used the examples of usage to get a connection.

Everything works fine including the client.sync() line.

When I run the session = client.sesssion line I get an AttributeError: 'nYnabClient_' object has no attribute 'sesssion'

The code I am trying to run on python v3.6 is the following:

from pynYNAB.Client import nYnabClient
from pynYNAB.connection import nYnabConnection
from sqlalchemy.sql import func
from datetime import datetime

connection = nYnabConnection(email="myEmail", password="myPassword")
connection.init_session()
client = nYnabClient(nynabconnection=connection, budgetname="API_test")
client.sync()

session = client.sesssion #<-- this is where I get the AttributeError

# sum of the amounts for all transactions younger than 10 weeks
session.query(func.sum(Transaction.amount)).filter(Transaction.date > datetime.datetime.now() - datetime.timedelta(weeks=10)).scalar()

any suggestions why that might be or what I have to change in the code of the package?

natanweinberger commented 6 years ago

Looks like it's possibly just a typo, "sesssion" instead of "session"?