@@ -20,7 +20,6 @@ class Api(object):
2020 different actions again to `create`, `update` and `delete` entities.
2121 It also provides functions with informational character only.
2222 """
23-
2423 def __init__ (self , url , app_id , username = None , password = None , token = None , encryption = False , timeout = None , ssl_verify = True , user_agent = None ):
2524
2625 """ contructor method
@@ -45,7 +44,6 @@ def __init__(self, url, app_id, username=None, password=None, token=None, encryp
4544 :param user_agent: With this parameter you can define a own user agent header string., defaults to None
4645 :type user_agent: str, optional
4746 """
48-
4947 self ._api_url = url
5048 self ._api_appid = app_id
5149 self ._api_username = username
@@ -89,7 +87,6 @@ def _query(self, path='user', headers=None, method=GET, data=None, params=None,
8987 :return: If query returns any data it returns this dict or list else it returns last exit status
9088 :rtype: Union[bool, dict, list]
9189 """
92-
9390 _api_path = path
9491 _api_headers = headers or {}
9592 _method = method
@@ -124,10 +121,7 @@ def _query(self, path='user', headers=None, method=GET, data=None, params=None,
124121 return result ['data' ]
125122
126123 def _login (self ):
127-
128- """ Login method
129- """
130-
124+ """ Login method """
131125 _auth = HTTPBasicAuth (self ._api_username , self ._api_password )
132126 resp = self ._query (method = POST , auth = _auth )
133127
@@ -139,7 +133,6 @@ def get_token(self):
139133 :return: Returns the api token from the last successful login.
140134 :rtype: str
141135 """
142-
143136 return self ._api_token
144137
145138 def get_entity (self , controller , controller_path = None , params = None ):
@@ -155,7 +148,6 @@ def get_entity(self, controller, controller_path=None, params=None):
155148 :return: Result of the query. It can be either a 'list' or 'dict'.
156149 :rtype: Union[dict, list]
157150 """
158-
159151 _path = controller
160152 _controller_path = controller_path
161153 _params = params
@@ -180,7 +172,6 @@ def create_entity(self, controller, controller_path=None, data=None, params=None
180172 :return: Returns the newly created entity.
181173 :rtype: Union[dict, list]
182174 """
183-
184175 _path = controller
185176 _controller_path = controller_path
186177 _params = params
@@ -203,7 +194,6 @@ def delete_entity(self, controller, controller_path, params=None):
203194 :return: Returns True if entity was deleted successfully or either 'dict' or 'list' of entities to work on.
204195 :rtype: Union[book, dict, list]
205196 """
206-
207197 _path = '{}/{}' .format (controller , controller_path )
208198 _params = params
209199
@@ -224,7 +214,6 @@ def update_entity(self, controller, controller_path=None, data=None, params=None
224214 :return: Returns either a 'dict' or 'list' of the changed entity
225215 :rtype: Union[dict, list]
226216 """
227-
228217 _path = controller
229218 _controller_path = controller_path
230219 _params = params
@@ -241,7 +230,6 @@ def controllers(self):
241230 :return: Returns a tuple of controller paths.
242231 :rtype: tuple
243232 """
244-
245233 result = self ._query (token = self ._api_token , method = OPTIONS , path = '/' )
246234
247235 controllers = ({re .sub (r'^/api/' + self ._api_appid + '/(.+)/$' , r'\1' , v ) for ctrl in result ['controllers' ] for (k , v ) in ctrl .items () if k == 'href' })
0 commit comments