Skip to content

Commit

Permalink
prep for release 0.3
Browse files Browse the repository at this point in the history
  • Loading branch information
rienafairefr committed Oct 31, 2016
1 parent 40f1e55 commit d466c86
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 13 deletions.
28 changes: 16 additions & 12 deletions pynYNAB/Client.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,7 @@


def clientfromargs(args, reset=False):
connection = nYnabConnection(args.email, args.password)
try:
client = nYnabClient(connection, budget_name=args.budgetname)
if reset:
# deletes the budget
client.delete_budget(args.budgetname)
client.create_budget(args.budgetname)
client.select_budget(args.budgetname)
return client
except BudgetNotFound:
print('No budget by the name %s found in nYNAB' % args.budgetname)
exit(-1)
return nYnabClient.from_obj(args,reset)


class BudgetNotFound(Exception):
Expand Down Expand Up @@ -52,6 +41,21 @@ def __init__(self, nynabconnection, budget_name):
self.first = True
self.sync()

@staticmethod
def from_obj(args, reset=False):
connection = nYnabConnection(args.email, args.password)
try:
client = nYnabClient(connection, budget_name=args.budgetname)
if reset:
# deletes the budget
client.delete_budget(args.budgetname)
client.create_budget(args.budgetname)
client.select_budget(args.budgetname)
return client
except BudgetNotFound:
print('No budget by the name %s found in nYNAB' % args.budgetname)
exit(-1)

def getinitialdata(self):
try:
getinitialdata = self.connection.dorequest({"device_info": {'id': self.connection.id}},
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

setup(
name='pynYNAB',
version='0.2',
version='0.3',
# Note: change 'master' to the tag name when release a new verion
download_url='https://github.com/rienafairefr/nYNABapi/tarball/master',

Expand Down

0 comments on commit d466c86

Please sign in to comment.