@@ -54,7 +54,7 @@ async def _make_request(self, method, relative_url, params=None, data=None):
5454 headers ["Authorization" ] = self .auth_token
5555 headers ["stream-auth-type" ] = "jwt"
5656
57- url = "{ }/{}" . format ( self . base_url , relative_url )
57+ url = f" { self . base_url } /{ relative_url } "
5858
5959 if method .__name__ in ["post" , "put" , "patch" ]:
6060 serialized = json .dumps (data )
@@ -102,16 +102,16 @@ async def update_user_partial(self, update):
102102 return await self .update_users_partial ([update ])
103103
104104 async def delete_user (self , user_id , ** options ):
105- return await self .delete ("users/{}" . format ( user_id ) , options )
105+ return await self .delete (f "users/{ user_id } " , options )
106106
107107 async def deactivate_user (self , user_id , ** options ):
108- return await self .post ("users/{}/deactivate" . format ( user_id ) , data = options )
108+ return await self .post (f "users/{ user_id } /deactivate" , data = options )
109109
110110 async def reactivate_user (self , user_id , ** options ):
111- return await self .post ("users/{}/reactivate" . format ( user_id ) , data = options )
111+ return await self .post (f "users/{ user_id } /reactivate" , data = options )
112112
113113 async def export_user (self , user_id , ** options ):
114- return await self .get ("users/{}/export" . format ( user_id ) , options )
114+ return await self .get (f "users/{ user_id } /export" , options )
115115
116116 async def ban_user (self , target_id , ** options ):
117117 data = {"target_user_id" : target_id , ** options }
@@ -168,14 +168,14 @@ async def update_message(self, message):
168168 if message .get ("id" ) is None :
169169 raise ValueError ("message must have an id" )
170170 return await self .post (
171- "messages/{}" . format ( message ["id" ]) , data = {"message" : message }
171+ f "messages/{ message ['id' ] } " , data = {"message" : message }
172172 )
173173
174174 async def delete_message (self , message_id , ** options ):
175- return await self .delete ("messages/{}" . format ( message_id ) , options )
175+ return await self .delete (f "messages/{ message_id } " , options )
176176
177177 async def get_message (self , message_id ):
178- return await self .get ("messages/{}" . format ( message_id ) )
178+ return await self .get (f "messages/{ message_id } " )
179179
180180 async def query_users (self , filter_conditions , sort = None , ** options ):
181181 params = options .copy ()
@@ -198,13 +198,13 @@ async def create_channel_type(self, data):
198198 return await self .post ("channeltypes" , data = data )
199199
200200 async def get_channel_type (self , channel_type ):
201- return await self .get ("channeltypes/{}" . format ( channel_type ) )
201+ return await self .get (f "channeltypes/{ channel_type } " )
202202
203203 async def list_channel_types (self ):
204204 return await self .get ("channeltypes" )
205205
206206 async def update_channel_type (self , channel_type , ** settings ):
207- return await self .put ("channeltypes/{}" . format ( channel_type ) , data = settings )
207+ return await self .put (f "channeltypes/{ channel_type } " , data = settings )
208208
209209 async def delete_channel_type (self , channel_type ):
210210 """
@@ -213,7 +213,7 @@ async def delete_channel_type(self, channel_type):
213213 :param channel_type: the channel type
214214 :return:
215215 """
216- return await self .delete ("channeltypes/{}" . format ( channel_type ) )
216+ return await self .delete (f "channeltypes/{ channel_type } " )
217217
218218 def channel (self , channel_type , channel_id = None , data = None ):
219219 """
@@ -233,13 +233,13 @@ async def create_command(self, data):
233233 return await self .post ("commands" , data = data )
234234
235235 async def delete_command (self , name ):
236- return await self .delete ("commands/{}" . format ( name ) )
236+ return await self .delete (f "commands/{ name } " )
237237
238238 async def get_command (self , name ):
239- return await self .get ("commands/{}" . format ( name ) )
239+ return await self .get (f "commands/{ name } " )
240240
241241 async def update_command (self , name , ** settings ):
242- return await self .put ("commands/{}" . format ( name ) , data = settings )
242+ return await self .put (f "commands/{ name } " , data = settings )
243243
244244 async def add_device (self , device_id , push_provider , user_id ):
245245 """
@@ -297,7 +297,7 @@ async def send_file(self, uri, url, name, user, content_type=None):
297297 data .add_field ("user" , json .dumps (user ))
298298 data .add_field ("file" , content , filename = name , content_type = content_type )
299299 async with self .session .post (
300- "{ }/{}" . format ( self . base_url , uri ) ,
300+ f" { self . base_url } /{ uri } " ,
301301 params = self .get_default_params (),
302302 data = data ,
303303 headers = headers ,
@@ -328,7 +328,7 @@ async def get_blocklist(self, name):
328328 :param name: the name of the blocklist
329329 :return: blocklist dict representation
330330 """
331- return await self .get ("blocklists/{}" . format ( name ) )
331+ return await self .get (f "blocklists/{ name } " )
332332
333333 async def update_blocklist (self , name , words ):
334334 """
@@ -338,15 +338,15 @@ async def update_blocklist(self, name, words):
338338 :param words: the list of blocked words (replaces the current list)
339339 :return:
340340 """
341- return await self .put ("blocklists/{}" . format ( name ) , data = {"words" : words })
341+ return await self .put (f "blocklists/{ name } " , data = {"words" : words })
342342
343343 async def delete_blocklist (self , name ):
344344 """Delete a blocklist by name
345345
346346 :param: the name of the blocklist
347347 :return:
348348 """
349- return await self .delete ("blocklists/{}" . format ( name ) )
349+ return await self .delete (f "blocklists/{ name } " )
350350
351351 async def close (self ):
352352 await self .session .close ()
0 commit comments