@@ -169,7 +169,7 @@ def revoke_refresh_token_uid():
169
169
user = auth .get_user (uid )
170
170
# Convert to seconds as the auth_time in the token claims is in seconds.
171
171
revocation_second = user .tokens_valid_after_timestamp / 1000
172
- print ('Tokens revoked at: {0}' . format ( revocation_second ) )
172
+ print (f 'Tokens revoked at: { revocation_second } ' )
173
173
# [END revoke_tokens]
174
174
# [START save_revocation_in_db]
175
175
metadata_ref = firebase_admin .db .reference ("metadata/" + uid )
@@ -183,7 +183,7 @@ def get_user(uid):
183
183
from firebase_admin import auth
184
184
185
185
user = auth .get_user (uid )
186
- print ('Successfully fetched user data: {0}' . format ( user .uid ) )
186
+ print (f 'Successfully fetched user data: { user .uid } ' )
187
187
# [END get_user]
188
188
189
189
def get_user_by_email ():
@@ -192,7 +192,7 @@ def get_user_by_email():
192
192
from firebase_admin import auth
193
193
194
194
user = auth .get_user_by_email (email )
195
- print ('Successfully fetched user data: {0}' . format ( user .uid ) )
195
+ print (f 'Successfully fetched user data: { user .uid } ' )
196
196
# [END get_user_by_email]
197
197
198
198
def bulk_get_users ():
@@ -221,7 +221,7 @@ def get_user_by_phone_number():
221
221
from firebase_admin import auth
222
222
223
223
user = auth .get_user_by_phone_number (phone )
224
- print ('Successfully fetched user data: {0}' . format ( user .uid ) )
224
+ print (f 'Successfully fetched user data: { user .uid } ' )
225
225
# [END get_user_by_phone]
226
226
227
227
def create_user ():
@@ -234,15 +234,15 @@ def create_user():
234
234
display_name = 'John Doe' ,
235
235
photo_url = 'http://www.example.com/12345678/photo.png' ,
236
236
disabled = False )
237
- print ('Sucessfully created new user: {0}' . format ( user .uid ) )
237
+ print (f 'Sucessfully created new user: { user .uid } ' )
238
238
# [END create_user]
239
239
return user .uid
240
240
241
241
def create_user_with_id ():
242
242
# [START create_user_with_id]
243
243
user = auth .create_user (
244
244
uid = 'some-uid' ,
email = '[email protected] ' ,
phone_number = '+15555550100' )
245
- print ('Sucessfully created new user: {0}' . format ( user .uid ) )
245
+ print (f 'Sucessfully created new user: { user .uid } ' )
246
246
# [END create_user_with_id]
247
247
248
248
def update_user (uid ):
@@ -256,7 +256,7 @@ def update_user(uid):
256
256
display_name = 'John Doe' ,
257
257
photo_url = 'http://www.example.com/12345678/photo.png' ,
258
258
disabled = True )
259
- print ('Sucessfully updated user: {0}' . format ( user .uid ) )
259
+ print (f 'Sucessfully updated user: { user .uid } ' )
260
260
# [END update_user]
261
261
262
262
def delete_user (uid ):
@@ -271,10 +271,10 @@ def bulk_delete_users():
271
271
272
272
result = auth .delete_users (["uid1" , "uid2" , "uid3" ])
273
273
274
- print ('Successfully deleted {0 } users' . format ( result . success_count ) )
275
- print ('Failed to delete {0 } users' . format ( result . failure_count ) )
274
+ print (f 'Successfully deleted { result . success_count } users' )
275
+ print (f 'Failed to delete { result . failure_count } users' )
276
276
for err in result .errors :
277
- print ('error #{0 }, reason: {1}' . format ( result .index , result . reason ) )
277
+ print (f 'error #{ result . index } , reason: { result .reason } ' )
278
278
# [END bulk_delete_users]
279
279
280
280
def set_custom_user_claims (uid ):
@@ -475,10 +475,11 @@ def import_users():
475
475
hash_alg = auth .UserImportHash .hmac_sha256 (key = b'secret_key' )
476
476
try :
477
477
result = auth .import_users (users , hash_alg = hash_alg )
478
- print ('Successfully imported {0} users. Failed to import {1} users.' .format (
479
- result .success_count , result .failure_count ))
478
+ print (
479
+ f'Successfully imported { result .success_count } users. Failed to import '
480
+ f'{ result .failure_count } users.' )
480
481
for err in result .errors :
481
- print ('Failed to import {0} due to {1}' . format ( users [err .index ].uid , err .reason ) )
482
+ print (f 'Failed to import { users [err .index ].uid } due to { err .reason } ' )
482
483
except exceptions .FirebaseError :
483
484
# Some unrecoverable error occurred that prevented the operation from running.
484
485
pass
@@ -1012,7 +1013,7 @@ def revoke_refresh_tokens_tenant(tenant_client, uid):
1012
1013
user = tenant_client .get_user (uid )
1013
1014
# Convert to seconds as the auth_time in the token claims is in seconds.
1014
1015
revocation_second = user .tokens_valid_after_timestamp / 1000
1015
- print ('Tokens revoked at: {0}' . format ( revocation_second ) )
1016
+ print (f 'Tokens revoked at: { revocation_second } ' )
1016
1017
# [END revoke_tokens_tenant]
1017
1018
1018
1019
def verify_id_token_and_check_revoked_tenant (tenant_client , id_token ):
0 commit comments