rienafairefr / pynYNAB

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

UUID format error when connecting #27

Closed gehan closed 7 years ago

gehan commented 7 years ago

Hi,

When I try to make a nYnabClient object I get a failure here:

https://github.com/rienafairefr/nYNABapi/blob/master/pynYNAB/schema/Entity.py#L230

ValueError: badly formed hexadecimal UUID string

entityDict = {
    u'entities_scheduled_transaction_id': u'7d5d35d1-00b8-7630-fb4c-2c4f50bd4633',
    u'imported_date': None, 
    u'credit_amount': 0, 
    u'cleared': u'Uncleared', 
    u'transfer_transaction_id': None, 
    u'id': u'7d5d35d1-00b8-7630-fb4c-2c4f50bd4633_2016-11-03', 
    u'entities_account_id': u'ac962d11-e408-e5f3-13e3-2c4f4ffa2e70', 
    u'imported_payee': None, 
    u'transfer_subtransaction_id': None, 
    u'entities_subcategory_id': None, 
    u'subcategory_credit_amount_preceding': None, 
    u'source': u'Scheduler', 
    u'date_entered_from_schedule': u'2016-11-03', 
    u'memo': u'DMC14', 
    u'flag': None, 
    u'is_tombstone': True, 
    u'date': u'2016-11-03', 
    u'entities_payee_id': u'c620cba5-2794-60c6-5d3e-2c4f5008f48d', 
    u'accepted': True, 
    u'check_number': None, 
    u'cash_amount': 0, 
    u'transfer_account_id': None, 
    u'amount': 3600000, 
    u'matched_transaction_id': None, 
    u'ynab_id': None
}

column.name = 'id'

# so it's trying to do this
UUID("7d5d35d1-00b8-7630-fb4c-2c4f50bd4633_2016-11-03".split('/')[-1])

I'll try to fix myself but might take me a while. Any ideas...?!

I found the transaction itself and it's actually on 2016-11-08. From the blob above looks like it was a scheduled transaction..? If I take the date off the end of the id then UUID doesn't fail

rienafairefr commented 7 years ago

Hmm, looks like ids for the api are a mess ! Sometimes it's standard 7d5d35d1-00b8-7630-fb4c-2c4f50bd463 Sometimes bla/foo/7d5d35d1-00b8-7630-fb4c-2c4f50bd463 Sometimes dcdfd/7d5d35d1-00b8-7630-fb4c-2c4f50bd463 Apparently also sometimes 7d5d35d1-00b8-7630-fb4c-2c4f50bd463_YYY-MM-DD,

I think I'll switch to a regex like [0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}

Thanks for the bug report!

gehan commented 7 years ago

Yeah looks all over the place! Nothing like an inconsistent id.

I'll test again whenever you get to make the change 😎

Also good work with this lib!

On Thu, 19 Jan 2017, 12:04 rienafairefr, notifications@github.com wrote:

Hmm, looks like ids for the api are a mess ! Sometimes it's standard 7d5d35d1-00b8-7630-fb4c-2c4f50bd463 Sometimes bla/foo/7d5d35d1-00b8-7630-fb4c-2c4f50bd463 Sometimes dcdfd/7d5d35d1-00b8-7630-fb4c-2c4f50bd463 Apparently also sometimes 7d5d35d1-00b8-7630-fb4c-2c4f50bd463_YYY-MM-DD,

I think I'll switch to a regex like [0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}

Thanks for the bug report!

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/rienafairefr/nYNABapi/issues/27#issuecomment-273759811, or mute the thread https://github.com/notifications/unsubscribe-auth/AAOkRvW2Rm-qUbwoETWectFWm93k2YAEks5rT1FVgaJpZM4Lnawn .

rienafairefr commented 7 years ago

827be01fb19fd1e4e2357bd65309302d4e7e78ee seems to solve the problem, test it with your data and see how it goes :-) Cheers

gehan commented 7 years ago

That error is fixed yes... but now there is something else :'(

I'll make an issue for the other one. Something to do with dates now.