rienafairefr / pynYNAB

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

pynYNAB isn't returning all subcategories?? #53

Open smseidl opened 6 years ago

smseidl commented 6 years ago

I'm trying to use the ynab-email script (https://github.com/jtsmith2/ynab-email) that is written on top of pynYNAB to send an email of category balances each day, but the script keeps sending out 0's for all the current balances. I've openned an issue with them, and they responding "It looks like for some reason pynYNAB isn't returning all of your subcategories."

Can you please review the issue over there (https://github.com/jtsmith2/ynab-email/issues/2) and see if you feel this is an issue with pynYNAB, or their script?

I've attempted adding in some debug lines, and it seems like pynYNAB isn't returning the current month's subcategories, but I haven't spent much time understanding the options of pynYNAB to confirm.

rienafairefr commented 6 years ago

OK, cannot reproduce, we have to see what happens for your situation:

Next step would be digging in the JSON data that is received by pynYNAB before it's treated and incorporated in the collection client.budget.be_monthly_subcategory_budget_calculations and other collections.

checkout out latest 24c230b commit Run this script adapted from the one in the ynab-email issue :

import logging
from pynYNAB.Client import nYnabClient
from pynYNAB.connection import nYnabConnection

ynabUser = #TYPE YOUR USERNAME HERE
ynabPassword = #TYPE YOUR PASSWORD HERE
ynabBudgetName = #TYPE YOUR BUDGET NAME HERE, MIGHT NOT BE 'My Budget' 

print('Getting YNAB info')

LOG = logging.getLogger('pynYNAB.connection')
LOG.setLevel(logging.DEBUG)

connection = nYnabConnection(ynabUser, ynabPassword)
connection.init_session()
client = nYnabClient(nynabconnection=connection, budgetname=ynabBudgetName)

The script should spit out massive amount of data, some of it is sensitive, don't post it. I just need lines containing the string mcb/, to see if they contain the recent months

smseidl commented 6 years ago

Struggling with getting the new commit. Tried pip and setup.py and both are giving this error:

Conversion of long_description from markdown to reStructuredText failed, skipping.

Also, with the setup.py, I also get this error at the end:

Running ruamel.yaml-0.15.32/setup.py -q bdist_egg --dist-dir /tmp/easy_install-0ZHj74/ruamel.yaml-0.15.32/egg-dist-tmp-ptErjF sys.argv ['/tmp/easy_install-0ZHj74/ruamel.yaml-0.15.32/setup.py', '-q', 'bdist_egg', '--dist-dir', '/tmp/easy_install-0ZHj74/ruamel.yaml-0.15.32/egg-dist-tmp-ptErjF'] error: Setup script exited with error in ruamel.yaml setup command: Invalid environment marker: platform_python_implementation=="CPython" and python_version<="2.7"

smseidl commented 6 years ago

Got installed by removing what I had and using multiple pip commands for dependencies and the setup.py. But I'm getting 0 useful output:

scott@raspberrypi-pihole:~/ynab-email $ python debug.py Getting YNAB info No handlers could be found for logger "pynYNAB.connection"

scott@raspberrypi-pihole:~/ynab-email $ cat debug.py
import logging
from pynYNAB.Client import nYnabClient
from pynYNAB.connection import nYnabConnection

ynabUser = '##################'
ynabPassword = '#####################'
ynabBudgetName = '##############'

print('Getting YNAB info')

LOG = logging.getLogger('pynYNAB.connection')
LOG.setLevel(logging.DEBUG)

connection = nYnabConnection(ynabUser, ynabPassword)
connection.init_session()
client = nYnabClient(nynabconnection=connection, budgetname=ynabBudgetName)
rienafairefr commented 6 years ago

Sorry, you need to add a logging.basicConfig() (doc here) line to add basic streamhandler to the logging facility before the logging works. Add it anywhere in the script, before the client = ... line

smseidl commented 6 years ago

Please find the attached file for all lines matching "mcb/" mcb.txt

rienafairefr commented 6 years ago

OK I see only data for 2017-02 to 2017-04, it's really weird.

On Aug 27, 2017 05:37, "smseidl" notifications@github.com wrote:

Please find the attached file for all lines matching "mcb/" mcb.txt https://github.com/rienafairefr/pynYNAB/files/1254124/mcb.txt

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/rienafairefr/pynYNAB/issues/53#issuecomment-325175113, or mute the thread https://github.com/notifications/unsubscribe-auth/AAuS9Wsy52pz5BNY2Sgm85ziunarZzOaks5scOSGgaJpZM4O16Ci .