@@ -67,7 +67,7 @@ def url(self) -> str:
6767 return self .application_plan .plans_url + f'/metrics/{ self .metric .entity_id } /limits'
6868
6969 def list_per_app_plan (self , ** kwargs ):
70- log .info (f "[LIST] List limits per app plan: { kwargs } " )
70+ log .info ("[LIST] List limits per app plan: %s" , kwargs )
7171 url = self .parent .url + '/limits'
7272 response = self .rest .get (url = url , ** kwargs )
7373 instance = self ._create_instance (response = response )
@@ -177,7 +177,7 @@ def signup(self, params: dict, **kwargs) -> 'Account':
177177 **kwargs: Optional args
178178 Returns(Account): Account instance
179179 """
180- log .info (f "[SIGNUP] Create new Signup: { kwargs } " )
180+ log .info ("[SIGNUP] Create new Signup: %s" , kwargs )
181181 url = self .threescale_client .admin_api_url + '/signup'
182182 response = self .rest .post (url = url , json = params , ** kwargs )
183183 instance = self ._create_instance (response = response )
@@ -191,7 +191,7 @@ def set_plan(self, entity_id: int, plan_id: int, **kwargs):
191191 **kwargs: Optional args
192192 Returns:
193193 """
194- log .info (f "[PLAN] Set plan for an account({ entity_id } ): { plan_id } " )
194+ log .info ("[PLAN] Set plan for an account(%s ): %s" , entity_id , plan_id )
195195 params = dict (plan_id = plan_id )
196196 url = self ._entity_url (entity_id = entity_id ) + '/change_plan'
197197 response = self .rest .put (url = url , json = params , ** kwargs )
@@ -206,7 +206,7 @@ def send_message(self, entity_id: int, body: str, **kwargs) -> Dict:
206206 **kwargs: Optional args
207207 Returns(Dict): Response
208208 """
209- log .info (f "[MSG] Send message to account ({ entity_id } ): { body } { kwargs } " )
209+ log .info ("[MSG] Send message to account (%s ): %s %s" , entity_id , body , kwargs )
210210 params = dict (body = body )
211211 url = self ._entity_url (entity_id = entity_id ) + '/messages'
212212 response = self .rest .post (url = url , json = params , ** kwargs )
@@ -252,22 +252,22 @@ def url(self) -> str:
252252 return self .parent .url + '/applications'
253253
254254 def change_plan (self , entity_id : int , plan_id : int , ** kwargs ):
255- log .info (f "[PLAN] Change plan for application ({ entity_id } ) to { plan_id } { kwargs } " )
255+ log .info ("[PLAN] Change plan for application (%s ) to %s %s" , entity_id , plan_id , kwargs )
256256 params = dict (plan_id = plan_id )
257257 url = self ._entity_url (entity_id = entity_id ) + '/change_plan'
258258 response = self .rest .put (url = url , json = params , ** kwargs )
259259 instance = utils .extract_response (response = response )
260260 return instance
261261
262262 def customize_plan (self , entity_id : int , ** kwargs ):
263- log .info (f "[PLAN] Customize plan for application ({ entity_id } ) { kwargs } " )
263+ log .info ("[PLAN] Customize plan for application (%s) %s" , entity_id , kwargs )
264264 url = self ._entity_url (entity_id = entity_id ) + '/customize_plan'
265265 response = self .rest .put (url = url , ** kwargs )
266266 instance = utils .extract_response (response = response )
267267 return instance
268268
269269 def decustomize_plan (self , entity_id : int , ** kwargs ):
270- log .info (f "[PLAN] Decustomize plan for application ({ entity_id } ) { kwargs } " )
270+ log .info ("[PLAN] Decustomize plan for application (%s) %s" , entity_id , kwargs )
271271 url = self ._entity_url (entity_id = entity_id ) + '/decustomize_plan'
272272 response = self .rest .put (url = url , ** kwargs )
273273 instance = utils .extract_response (response = response )
@@ -357,8 +357,8 @@ def url(self) -> str:
357357class Analytics (DefaultClient ):
358358 def _list_by_resource (self , resource_id : int , resource_type , metric_name : str = 'hits' ,
359359 since = None , period : str = 'year' , ** kwargs ):
360- log .info (f "List analytics by { resource_type } ( { resource_id } ) f"
361- f"or metric (# { metric_name } )" )
360+ log .info ("List analytics by %s (%s) for metric (#%s)" , resource_type , resource_id ,
361+ metric_name )
362362 params = dict (
363363 metric_name = metric_name ,
364364 since = since ,
@@ -388,9 +388,9 @@ def __init__(self, *args, entity_name='tenant', entity_collection='tenants', **k
388388 super ().__init__ (* args , entity_name = entity_name ,
389389 entity_collection = entity_collection , ** kwargs )
390390
391- def read (self , id , ** kwargs ):
391+ def read (self , entity_id , ** kwargs ):
392392 log .debug (self ._log_message ("[GET] Read Tenant" , args = kwargs ))
393- url = self ._entity_url (entity_id = id )
393+ url = self ._entity_url (entity_id = entity_id )
394394 response = self .rest .get (url = url , ** kwargs )
395395 instance = self ._create_instance (response = response )
396396 return instance
@@ -440,7 +440,7 @@ def url(self) -> str:
440440 return self .parent .url + '/proxy'
441441
442442 def deploy (self ) -> 'Proxy' :
443- log .info (f "[DEPLOY] { self . _entity_name } to Staging" )
443+ log .info ("[DEPLOY] %s to Staging" , self . _entity_name )
444444 url = f'{ self .url } /deploy'
445445 response = self .rest .post (url )
446446 instance = self ._create_instance (response = response )
@@ -487,7 +487,8 @@ def list(self, **kwargs):
487487
488488 def promote (self , version : int = 1 , from_env : str = 'sandbox' , to_env : str = 'production' ,
489489 ** kwargs ) -> 'Proxy' :
490- log .info (f"[PROMOTE] { self .service } version { version } from { from_env } to { to_env } " )
490+ log .info ("[PROMOTE] %s version %s from %s to %s" , self .service , version , from_env ,
491+ to_env )
491492 url = f'{ self .url } /{ from_env } /{ version } /promote'
492493 params = dict (to = to_env )
493494 kwargs .update ()
@@ -496,15 +497,15 @@ def promote(self, version: int = 1, from_env: str = 'sandbox', to_env: str = 'pr
496497 return instance
497498
498499 def latest (self , env : str = "sandbox" ) -> 'ProxyConfig' :
499- log .info (f "[LATEST] Get latest proxy configuration of { env } " )
500+ log .info ("[LATEST] Get latest proxy configuration of %s" , env )
500501 self ._env = env
501502 url = self .url + '/latest'
502503 response = self .rest .get (url = url )
503504 instance = self ._create_instance (response = response )
504505 return instance
505506
506507 def version (self , version : int = 1 , env : str = "sandbox" ) -> 'ProxyConfig' :
507- log .info (f "[VERSION] Get proxy configuration of { env } of version { version } " )
508+ log .info ("[VERSION] Get proxy configuration of %s of version %s" , env , version )
508509 self ._env = env
509510 url = f'{ self .url } /{ version } '
510511 response = self .rest .get (url = url )
@@ -873,7 +874,7 @@ def state_update(self, entity_id: int, state: InvoiceState, **kwargs):
873874 Values allowed (depend on the previous state):
874875 cancelled, failed, paid, unpaid, pending, finalized
875876 """
876- log .info (f "[Invoice] state changed for invoice ({ entity_id } ): { state } " )
877+ log .info ("[Invoice] state changed for invoice (%s ): %s" , entity_id , state )
877878 params = dict (state = state .value )
878879 url = self ._entity_url (entity_id ) + '/state'
879880 response = self .rest .put (url = url , json = params , ** kwargs )
@@ -882,7 +883,7 @@ def state_update(self, entity_id: int, state: InvoiceState, **kwargs):
882883
883884 def charge (self , entity_id : int ):
884885 """Charge an Invoice."""
885- log .info (f "[Invoice] charge invoice ({ entity_id } )" )
886+ log .info ("[Invoice] charge invoice (%s)" , entity_id )
886887 url = self ._entity_url (entity_id ) + '/charge'
887888 response = self .rest .post (url )
888889 instance = self ._create_instance (response = response )
@@ -974,15 +975,13 @@ def service(self) -> 'Service':
974975 def __getitem__ (self , key ):
975976 if "proxy_configs" in self .entity :
976977 return self .entity ["proxy_configs" ][key ]
977- else :
978- return super ().__getitem__ (key )
978+ return super ().__getitem__ (key )
979979
980980 # Same problem as in __getitem__.
981981 def __len__ (self ):
982982 if "proxy_configs" in self .entity :
983983 return len (self .entity ["proxy_configs" ])
984- else :
985- return super ().__len__ ()
984+ return super ().__len__ ()
986985
987986
988987class Policy (DefaultResource ):
@@ -1270,7 +1269,7 @@ def permissions(self) -> 'UserPermissionsClient':
12701269
12711270
12721271class AccountPlan (DefaultResource ):
1273- def __init__ (self , entity_name = 'name ' , ** kwargs ):
1272+ def __init__ (self , entity_name = 'system_name ' , ** kwargs ):
12741273 super ().__init__ (entity_name = entity_name , ** kwargs )
12751274
12761275
0 commit comments