collibra-connector 1.0.5__tar.gz → 1.0.6__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: collibra-connector
3
- Version: 1.0.5
3
+ Version: 1.0.6
4
4
  Summary: A standard Python connector for the Collibra Data Governance Center API.
5
5
  Author-email: Raül Dalgamonni <rauldalgamonnialonso@gmail.com>
6
6
  Project-URL: Homepage, https://github.com/rauldaal/collibra-python-connector
@@ -1,5 +1,8 @@
1
+ import logging
2
+ import requests
1
3
  from requests.auth import HTTPBasicAuth
2
4
 
5
+ from .api import Asset
3
6
 
4
7
  class CollibraConnector():
5
8
  """
@@ -8,7 +11,7 @@ class CollibraConnector():
8
11
  The authentication is done using HTTP Basic Auth.
9
12
  """
10
13
 
11
- def __init__(self, api: str, username: str, password: str):
14
+ def __init__(self, api: str, username: str, password: str, timeout: int = 30):
12
15
  """
13
16
  Initializes the CollibraConnector with API URL and authentication credentials.
14
17
  :param api: The API URL for Collibra.
@@ -18,10 +21,29 @@ class CollibraConnector():
18
21
  self.__auth = HTTPBasicAuth(username, password)
19
22
  self.__api = api + "/rest/2.0"
20
23
  self.__base_url = api
24
+ self.__timeout = timeout
25
+
26
+ self.asset = Asset(self)
27
+
28
+ logging.basicConfig(level=logging.INFO)
29
+ self.logger = logging.getLogger(__name__)
21
30
 
22
31
  def __repr__(self):
23
32
  return f"CollibraConnector(api={self.__api}, auth={self.__auth})"
24
33
 
34
+ def test_connection(self):
35
+ """Test the connection to Collibra API"""
36
+ try:
37
+ response = requests.get(
38
+ f"{self.__api}/info",
39
+ auth=self.__auth,
40
+ timeout=self.__timeout
41
+ )
42
+ return response.status_code == 200
43
+ except Exception as e:
44
+ self.logger.error(f"Connection test failed: {e}")
45
+ return False
46
+
25
47
  @property
26
48
  def api(self):
27
49
  return self.__api
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: collibra-connector
3
- Version: 1.0.5
3
+ Version: 1.0.6
4
4
  Summary: A standard Python connector for the Collibra Data Governance Center API.
5
5
  Author-email: Raül Dalgamonni <rauldalgamonnialonso@gmail.com>
6
6
  Project-URL: Homepage, https://github.com/rauldaal/collibra-python-connector
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "collibra-connector"
3
- version = "1.0.5"
3
+ version = "1.0.6"
4
4
  authors = [
5
5
  { name="Raül Dalgamonni", email="rauldalgamonnialonso@gmail.com"},
6
6
  ]