kopia lustrzana https://github.com/ihabunek/toot
				
				
				
			Fixes for py3
							rodzic
							
								
									cc512bf759
								
							
						
					
					
						commit
						26be88aed6
					
				| 
						 | 
				
			
			@ -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))
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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):
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Ładowanie…
	
		Reference in New Issue