Commit 844bb165 authored by Morten Brekkevold's avatar Morten Brekkevold

Format all Python code using Black.

parent 64cf304c
This diff is collapsed.
......@@ -8,6 +8,7 @@ from simple_rest_client.exceptions import NotFoundError, ClientError
def _translate_notfounderror(func):
"""Decorator for standardized handling of NotFoundError"""
@functools.wraps(func)
def wrapper(*args, **kwargs):
try:
......@@ -23,22 +24,22 @@ class NAVAPI(object):
self.api = API(
url,
headers={
'Authorization': 'Token {}'.format(auth_token),
'Content-Type': 'application/json',
"Authorization": "Token {}".format(auth_token),
"Content-Type": "application/json",
},
append_slash=True,
json_encode_body=True,
)
self.api.add_resource(resource_name='netbox')
self.api.add_resource(resource_name='room')
self.api.add_resource(resource_name="netbox")
self.api.add_resource(resource_name="room")
self.api.add_resource(resource_name="version")
self.api.add_resource(
resource_name="management_profile", resource_class=ManagementProfileResource
)
def list_netboxes(self):
response = self.api.netbox.list(params={'page_size': 1000})
return response.body['results']
response = self.api.netbox.list(params={"page_size": 1000})
return response.body["results"]
@_translate_notfounderror
def get_netbox(self, netbox_id):
......@@ -93,8 +94,10 @@ class ManagementProfileResource(Resource):
"update": {"method": "PUT", "url": "management-profile/{}"},
}
# Exception classes
class ApiError(Exception):
pass
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment