@@ -76,24 +76,24 @@ def select_revision():
7676
7777 # Create an instance of a Dropbox class, which can make requests to the API.
7878 print ("Creating a Dropbox object..." )
79- dbx = dropbox .Dropbox (TOKEN )
79+ with dropbox .Dropbox (TOKEN ) as dbx :
8080
81- # Check that the access token is valid
82- try :
83- dbx .users_get_current_account ()
84- except AuthError :
85- sys .exit ("ERROR: Invalid access token; try re-generating an "
86- "access token from the app console on the web." )
81+ # Check that the access token is valid
82+ try :
83+ dbx .users_get_current_account ()
84+ except AuthError :
85+ sys .exit ("ERROR: Invalid access token; try re-generating an "
86+ "access token from the app console on the web." )
8787
88- # Create a backup of the current settings file
89- backup ()
88+ # Create a backup of the current settings file
89+ backup ()
9090
91- # Change the user's file, create another backup
92- change_local_file ("updated" )
93- backup ()
91+ # Change the user's file, create another backup
92+ change_local_file (b "updated" )
93+ backup ()
9494
95- # Restore the local and Dropbox files to a certain revision
96- to_rev = select_revision ()
97- restore (to_rev )
95+ # Restore the local and Dropbox files to a certain revision
96+ to_rev = select_revision ()
97+ restore (to_rev )
9898
99- print ("Done!" )
99+ print ("Done!" )
0 commit comments