@@ -54,16 +54,16 @@ def get_backoff_time(self):
5454
5555class BaseClient :
5656 def __init__ (
57- self ,
58- token ,
59- base_url ,
60- user_agent = None ,
61- page_size = None ,
62- retry = True ,
63- retry_rate_limit_interval = 1.0 ,
64- retry_max = 5 ,
65- retry_statuses = None ,
66- ca_path = None ,
57+ self ,
58+ token ,
59+ base_url ,
60+ user_agent = None ,
61+ page_size = None ,
62+ retry = True ,
63+ retry_rate_limit_interval = 1.0 ,
64+ retry_max = 5 ,
65+ retry_statuses = None ,
66+ ca_path = None ,
6767 ):
6868 self .base_url = base_url
6969 self ._add_user_agent = user_agent
@@ -147,7 +147,7 @@ def load(self, target_type, target_id, target_parent_id=None):
147147 return result
148148
149149 def _api_call (
150- self , endpoint , model = None , method = None , data = None , filters = None
150+ self , endpoint , model = None , method = None , data = None , filters = None
151151 ):
152152 """
153153 Makes a call to the linode api. Data should only be given if the method is
@@ -201,7 +201,7 @@ def _api_call(
201201 return j
202202
203203 def _get_objects (
204- self , endpoint , cls , model = None , parent_id = None , filters = None
204+ self , endpoint , cls , model = None , parent_id = None , filters = None
205205 ):
206206 # handle non-default page sizes
207207 call_endpoint = endpoint
@@ -268,11 +268,11 @@ def __setattr__(self, key, value):
268268
269269 # helper functions
270270 def _get_and_filter (
271- self ,
272- obj_type ,
273- * filters ,
274- endpoint = None ,
275- parent_id = None ,
271+ self ,
272+ obj_type ,
273+ * filters ,
274+ endpoint = None ,
275+ parent_id = None ,
276276 ):
277277 parsed_filters = None
278278 if filters :
@@ -299,16 +299,16 @@ def _get_and_filter(
299299
300300class LinodeClient (BaseClient ):
301301 def __init__ (
302- self ,
303- token ,
304- base_url = "https://api.linode.com/v4" ,
305- user_agent = None ,
306- page_size = None ,
307- retry = True ,
308- retry_rate_limit_interval = 1.0 ,
309- retry_max = 5 ,
310- retry_statuses = None ,
311- ca_path = None ,
302+ self ,
303+ token ,
304+ base_url = "https://api.linode.com/v4" ,
305+ user_agent = None ,
306+ page_size = None ,
307+ retry = True ,
308+ retry_rate_limit_interval = 1.0 ,
309+ retry_max = 5 ,
310+ retry_statuses = None ,
311+ ca_path = None ,
312312 ):
313313 """
314314 The main interface to the Linode API.
@@ -346,38 +346,6 @@ def __init__(
346346 :param ca_path: The path to a CA file to use for API requests in this client.
347347 :type ca_path: str
348348 """
349- # retry_forcelist = [408, 429, 502]
350- #
351- # if retry_statuses is not None:
352- # retry_forcelist.extend(retry_statuses)
353- #
354- # # Ensure the max retries value is valid
355- # if not isinstance(retry_max, int):
356- # raise ValueError("retry_max must be an int")
357- #
358- # self.retry = retry
359- # self.retry_rate_limit_interval = float(retry_rate_limit_interval)
360- # self.retry_max = retry_max
361- # self.retry_statuses = retry_forcelist
362- #
363- # # Initialize the HTTP client session
364- # self.session = requests.Session()
365- #
366- # self._retry_config = LinearRetry(
367- # total=retry_max if retry else 0,
368- # status_forcelist=self.retry_statuses,
369- # respect_retry_after_header=True,
370- # backoff_factor=self.retry_rate_limit_interval,
371- # raise_on_status=False,
372- # # By default, POST is not an allowed method.
373- # # We should explicitly include it.
374- # allowed_methods={"DELETE", "GET", "POST", "PUT"},
375- # )
376- # retry_adapter = HTTPAdapter(max_retries=self._retry_config)
377- #
378- # self.session.mount("http://", retry_adapter)
379- # self.session.mount("https://", retry_adapter)
380-
381349 #: Access methods related to Linodes - see :any:`LinodeGroup` for
382350 #: more information
383351 self .linode = LinodeGroup (self )
@@ -466,11 +434,11 @@ def image_create(self, disk, label=None, description=None, tags=None):
466434 )
467435
468436 def image_create_upload (
469- self ,
470- label : str ,
471- region : str ,
472- description : Optional [str ] = None ,
473- tags : Optional [List [str ]] = None ,
437+ self ,
438+ label : str ,
439+ region : str ,
440+ description : Optional [str ] = None ,
441+ tags : Optional [List [str ]] = None ,
474442 ) -> Tuple [Image , str ]:
475443 """
476444 .. note:: This method is an alias to maintain backwards compatibility.
@@ -483,12 +451,12 @@ def image_create_upload(
483451 )
484452
485453 def image_upload (
486- self ,
487- label : str ,
488- region : str ,
489- file : BinaryIO ,
490- description : Optional [str ] = None ,
491- tags : Optional [List [str ]] = None ,
454+ self ,
455+ label : str ,
456+ region : str ,
457+ file : BinaryIO ,
458+ description : Optional [str ] = None ,
459+ tags : Optional [List [str ]] = None ,
492460 ) -> Image :
493461 """
494462 .. note:: This method is an alias to maintain backwards compatibility.
@@ -516,13 +484,13 @@ def domain_create(self, domain, master=True, **kwargs):
516484 return self .domains .create (domain , master = master , ** kwargs )
517485
518486 def tag_create (
519- self ,
520- label ,
521- instances = None ,
522- domains = None ,
523- nodebalancers = None ,
524- volumes = None ,
525- entities = [],
487+ self ,
488+ label ,
489+ instances = None ,
490+ domains = None ,
491+ nodebalancers = None ,
492+ volumes = None ,
493+ entities = [],
526494 ):
527495 """
528496 .. note:: This method is an alias to maintain backwards compatibility.
@@ -576,20 +544,19 @@ class MonitorClient(BaseClient):
576544 """
577545
578546 def __init__ (
579- self ,
580- token ,
581- base_url = "https://monitor-api.linode.com/v2beta" ,
582- user_agent = None ,
583- page_size = None ,
584- ca_path = None ,
585- retry = True ,
586- retry_rate_limit_interval = 1.0 ,
587- retry_max = 5 ,
588- retry_statuses = None ,
547+ self ,
548+ token ,
549+ base_url = "https://monitor-api.linode.com/v2beta" ,
550+ user_agent = None ,
551+ page_size = None ,
552+ ca_path = None ,
553+ retry = True ,
554+ retry_rate_limit_interval = 1.0 ,
555+ retry_max = 5 ,
556+ retry_statuses = None ,
589557 ):
590- # define properties and modules
591-
592- # define a metric group and add access to it through MonitorClient
558+ #: Access methods related to your monitor metrics - see :any:`MetricsGroup` for
559+ #: more information
593560 self .metrics = MetricsGroup (self )
594561
595562 super (MonitorClient , self ).__init__ (
@@ -601,5 +568,5 @@ def __init__(
601568 retry_rate_limit_interval = retry_rate_limit_interval ,
602569 retry_max = retry_max ,
603570 retry_statuses = retry_statuses ,
604- ca_path = ca_path
571+ ca_path = ca_path ,
605572 )
0 commit comments