Fixes for py3

This commit is contained in:
Ivan Habunek 2017-04-12 17:12:47 +02:00
parent cc512bf759
commit 26be88aed6
No known key found for this signature in database
GPG Key ID: CDBD63C43A30BB95
2 changed files with 5 additions and 7 deletions

View File

@ -7,10 +7,6 @@ CONFIG_APP_FILE = CONFIG_DIR + 'app.cfg'
CONFIG_USER_FILE = CONFIG_DIR + 'user.cfg'
def collapse(tuple):
return [v for k, v in tuple.__dict__.items()]
def _load(file, tuple_class):
if not os.path.exists(file):
return None
@ -29,7 +25,7 @@ def _save(file, named_tuple):
os.makedirs(directory)
with open(file, 'w') as f:
values = [v for k, v in named_tuple.__dict__.items()]
values = [v for v in named_tuple]
return f.write("\n".join(values))

View File

@ -29,6 +29,8 @@ def create_app_interactive():
print("App tokens saved to: {}".format(green(CONFIG_APP_FILE)))
save_app(app)
return app
def login_interactive(app):
print("\nLog in to " + green(app.base_url))
@ -55,12 +57,12 @@ def print_usage():
def cmd_post_status(app, user):
if len(sys.argv) < 3:
print red("No status text given")
print(red("No status text given"))
return
response = post_status(app, user, sys.argv[2])
print "Toot posted: " + green(response.get('url'))
print("Toot posted: " + green(response.get('url')))
def cmd_auth(app, user):