esecules / splitwise-csv

Upload expenses to splitwise from a csv file.
MIT License
25 stars 13 forks source link

Better Localization Handling #6

Open beniutek opened 6 years ago

beniutek commented 6 years ago

I'm following the process described in the readme I have obtained keys from splitwise I have a sample csv file that looks like this:

Transaction Date,Transaction Description,Debit Amount
07/02/2018,TEST1,9.99
26/02/2018,TEST2,9.99

I run the command python groupsplit.py ../test.csv 'Splitwise group name' Webbrowser opens and wants me to click authorize I click authorize I'm redirected to an site that has some xml information

This XML file does not appear to have any style information associated with it. The document tree is shown below.
<versions xmlns="http://docs.openstack.org/identity/api/v2.0">
<version status="stable" updated="2013-03-06T00:00:00Z" id="v3.0">
<media-types>
<media-type base="application/json" type="application/vnd.openstack.identity-v3+json"/>
<media-type base="application/xml" type="application/vnd.openstack.identity-v3+xml"/>
</media-types>
<links>
<link href="http://localhost:5000/v3/" rel="self"/>
</links>
</version>
<version status="stable" updated="2014-04-17T00:00:00Z" id="v2.0">
<media-types>
<media-type base="application/json" type="application/vnd.openstack.identity-v2.0+json"/>
<media-type base="application/xml" type="application/vnd.openstack.identity-v2.0+xml"/>
</media-types>
<links>
<link href="http://localhost:5000/v2.0/" rel="self"/>
<link href="http://docs.openstack.org/api/openstack-identity-service/2.0/content/" type="text/html" rel="describedby"/>
<link href="http://docs.openstack.org/api/openstack-identity-service/2.0/identity-dev-guide-2.0.pdf" type="application/pdf" rel="describedby"/>
</links>
<link href="http://localhost:5000/v2.0/" rel="self"/>
<link href="http://docs.openstack.org/api/openstack-identity-service/2.0/content/" type="text/html" rel="describedby"/>
<link href="http://docs.openstack.org/api/openstack-identity-service/2.0/identity-dev-guide-2.0.pdf" type="application/pdf" rel="describedby"/>
</version>
</versions>

the url is localhost:5000 so this is the callback site but I can't do anything from there. There are no prompts to describe the columns in my csv etc. Have I missed any steps when setting up the app?

beniutek commented 6 years ago

turns out that all I had to was to change the callback site to 127.0.0.1 (becuase of how my hosts file is configured) I'm receiving now Invalid OAuth Request now as an error which I assume could be something i can handle

esecules commented 6 years ago

Hey thanks for bringing this to my attention. Were you able to grant access to your account to your api key?

beniutek commented 6 years ago

Yes, I was able to do so. Think that my browsers was cashing some stuff from previous request - when doing that in incognito mode everything started working correctly. short disclamer - i can read python because i can read english, not because i'm proficient with that particular language. I do have some other errors - the difference between US and EU date (days and month switched) was kinda obvious one (I assume all it took for the program to read EU formatted dates was to change the line in method self.transactions to be days/months/years right?), but then I can't seem to upload any of the transactions from my csv file. When I get to the method self.ask_for_splits() i see that self.self.transactions is an empty array although I have several rows in the csv file. I see that we are passing self all around so I assume that is a python thing to do, but it seems like maybe the scope is not being preserved?

beniutek commented 6 years ago

okay so I have found the reason behind that missing self.transactions it was if float(r[self.csv.amount_col]) < 0: in make transactions, in my csv file all values are positive floats, and as far as I understand, you program assumes negative floats. phew!

esecules commented 6 years ago

to solve the date issue and skipping positive amounts I could create a config file or add it to the first use questionnaire thing. But in the mean time you're always welcome to submit a PR.

I created this program to take my bank statement csv files as an input and ask me which of these transactions I wanted to split with a predefined group so I naturally wanted to skip over any deposits and only ask about debit transactions.

I don't think theres a bug here. Filing under enhancements.

beniutek commented 6 years ago

Yeah there are no bugs on the code, problems I've had was either the environment (server running on different url than the callback one) or data problems (csv had different date formats and values were positive or negative). This issue can be closed. btw, thanks for opensourcing your program, it helps a lot! (i might be inclined to work on this one to make it a configuration thing, will let you know once I've submitted a PR)