konnektr-graph 0.1.1__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.
- konnektr_graph-0.1.1/LICENSE +21 -0
- konnektr_graph-0.1.1/PKG-INFO +97 -0
- konnektr_graph-0.1.1/README.md +77 -0
- konnektr_graph-0.1.1/konnektr_graph/__init__.py +35 -0
- konnektr_graph-0.1.1/konnektr_graph/aio/__init__.py +7 -0
- konnektr_graph-0.1.1/konnektr_graph/aio/client.py +491 -0
- konnektr_graph-0.1.1/konnektr_graph/auth/__init__.py +21 -0
- konnektr_graph-0.1.1/konnektr_graph/auth/async_client_secret_credential.py +78 -0
- konnektr_graph-0.1.1/konnektr_graph/auth/async_device_code_credential.py +135 -0
- konnektr_graph-0.1.1/konnektr_graph/auth/client_secret_credential.py +75 -0
- konnektr_graph-0.1.1/konnektr_graph/auth/device_code_credential.py +131 -0
- konnektr_graph-0.1.1/konnektr_graph/auth/protocol.py +31 -0
- konnektr_graph-0.1.1/konnektr_graph/auth/static_token_credential.py +49 -0
- konnektr_graph-0.1.1/konnektr_graph/client.py +460 -0
- konnektr_graph-0.1.1/konnektr_graph/exceptions.py +43 -0
- konnektr_graph-0.1.1/konnektr_graph/models.py +129 -0
- konnektr_graph-0.1.1/konnektr_graph/py.typed +0 -0
- konnektr_graph-0.1.1/konnektr_graph.egg-info/PKG-INFO +97 -0
- konnektr_graph-0.1.1/konnektr_graph.egg-info/SOURCES.txt +22 -0
- konnektr_graph-0.1.1/konnektr_graph.egg-info/dependency_links.txt +1 -0
- konnektr_graph-0.1.1/konnektr_graph.egg-info/requires.txt +2 -0
- konnektr_graph-0.1.1/konnektr_graph.egg-info/top_level.txt +1 -0
- konnektr_graph-0.1.1/pyproject.toml +35 -0
- konnektr_graph-0.1.1/setup.cfg +4 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
Copyright (c) Konnektr.
|
|
2
|
+
|
|
3
|
+
MIT License
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: konnektr-graph
|
|
3
|
+
Version: 0.1.1
|
|
4
|
+
Summary: Konnektr Graph SDK for Python
|
|
5
|
+
Author-email: Konnektr <info@konnektr.io>
|
|
6
|
+
Project-URL: Homepage, https://github.com/konnektr-io/graph-client-sdk-python
|
|
7
|
+
Project-URL: Bug Tracker, https://github.com/konnektr-io/graph-client-sdk-python/issues
|
|
8
|
+
Classifier: Programming Language :: Python :: 3
|
|
9
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
10
|
+
Classifier: Operating System :: OS Independent
|
|
11
|
+
Classifier: Development Status :: 4 - Beta
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
14
|
+
Requires-Python: >=3.8
|
|
15
|
+
Description-Content-Type: text/markdown
|
|
16
|
+
License-File: LICENSE
|
|
17
|
+
Requires-Dist: requests>=2.28.0
|
|
18
|
+
Requires-Dist: aiohttp>=3.8.0
|
|
19
|
+
Dynamic: license-file
|
|
20
|
+
|
|
21
|
+
# Konnektr Graph SDK for Python
|
|
22
|
+
|
|
23
|
+
A powerful, Python SDK for [Konnektr Graph](https://konnektr.io), fully compatible with the Azure Digital Twins API but optimized for the Konnektr ecosystem.
|
|
24
|
+
|
|
25
|
+
## Features
|
|
26
|
+
|
|
27
|
+
- **Azure-Free**: No dependencies on Azure libraries.
|
|
28
|
+
- **Synchronous & Asynchronous**: High-performance clients for both threaded and async workflows.
|
|
29
|
+
- **Modular Auth**: Supports OAuth 2.0 Client Credentials, Device Code Flow, and Static Tokens.
|
|
30
|
+
- **Auto-Pagination**: Seamlessly iterate through large query results and resource lists.
|
|
31
|
+
- **Data Models**: Typed dataclasses for Digital Twins, Models, Relationships, and Jobs.
|
|
32
|
+
|
|
33
|
+
## Installation
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
pip install konnektr-graph
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Quick Start
|
|
40
|
+
|
|
41
|
+
### Synchronous Client
|
|
42
|
+
|
|
43
|
+
```python
|
|
44
|
+
from konnektr_graph import KonnektrGraphClient
|
|
45
|
+
from konnektr_graph.auth import ClientSecretCredential
|
|
46
|
+
|
|
47
|
+
# Authenticate
|
|
48
|
+
cred = ClientSecretCredential(
|
|
49
|
+
domain="auth.konnektr.io",
|
|
50
|
+
audience="https://graph.konnektr.io",
|
|
51
|
+
client_id="YOUR_CLIENT_ID",
|
|
52
|
+
client_secret="YOUR_CLIENT_SECRET"
|
|
53
|
+
)
|
|
54
|
+
|
|
55
|
+
# Initialize Client
|
|
56
|
+
client = KonnektrGraphClient("https://your-graph-endpoint.konnektr.io", cred)
|
|
57
|
+
|
|
58
|
+
# Get a Digital Twin
|
|
59
|
+
twin = client.get_digital_twin("my-twin-id")
|
|
60
|
+
print(twin)
|
|
61
|
+
|
|
62
|
+
# Query Twins with auto-pagination
|
|
63
|
+
for twin in client.query_twins("SELECT * FROM digitaltwins"):
|
|
64
|
+
print(twin)
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### Asynchronous Client
|
|
68
|
+
|
|
69
|
+
```python
|
|
70
|
+
import asyncio
|
|
71
|
+
from konnektr_graph.aio import KonnektrGraphClient
|
|
72
|
+
from konnektr_graph.auth import AsyncClientSecretCredential
|
|
73
|
+
|
|
74
|
+
async def main():
|
|
75
|
+
cred = AsyncClientSecretCredential(
|
|
76
|
+
domain="auth.konnektr.io",
|
|
77
|
+
audience="https://graph.konnektr.io",
|
|
78
|
+
client_id="...",
|
|
79
|
+
client_secret="..."
|
|
80
|
+
)
|
|
81
|
+
|
|
82
|
+
async with KonnektrGraphClient("https://your-graph-endpoint.konnektr.io", cred) as client:
|
|
83
|
+
twin = await client.get_digital_twin("my-twin-id")
|
|
84
|
+
print(twin)
|
|
85
|
+
|
|
86
|
+
asyncio.run(main())
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
## Authentication Options
|
|
90
|
+
|
|
91
|
+
- `ClientSecretCredential` / `AsyncClientSecretCredential`: Ideal for server-to-server scenarios.
|
|
92
|
+
- `DeviceCodeCredential` / `AsyncDeviceCodeCredential`: Best for interactive CLI tools.
|
|
93
|
+
- `StaticTokenCredential`: Use when you already have a valid access token.
|
|
94
|
+
|
|
95
|
+
## License
|
|
96
|
+
|
|
97
|
+
This project is licensed under the MIT License - see the LICENSE file for details.
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
# Konnektr Graph SDK for Python
|
|
2
|
+
|
|
3
|
+
A powerful, Python SDK for [Konnektr Graph](https://konnektr.io), fully compatible with the Azure Digital Twins API but optimized for the Konnektr ecosystem.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- **Azure-Free**: No dependencies on Azure libraries.
|
|
8
|
+
- **Synchronous & Asynchronous**: High-performance clients for both threaded and async workflows.
|
|
9
|
+
- **Modular Auth**: Supports OAuth 2.0 Client Credentials, Device Code Flow, and Static Tokens.
|
|
10
|
+
- **Auto-Pagination**: Seamlessly iterate through large query results and resource lists.
|
|
11
|
+
- **Data Models**: Typed dataclasses for Digital Twins, Models, Relationships, and Jobs.
|
|
12
|
+
|
|
13
|
+
## Installation
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
pip install konnektr-graph
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Quick Start
|
|
20
|
+
|
|
21
|
+
### Synchronous Client
|
|
22
|
+
|
|
23
|
+
```python
|
|
24
|
+
from konnektr_graph import KonnektrGraphClient
|
|
25
|
+
from konnektr_graph.auth import ClientSecretCredential
|
|
26
|
+
|
|
27
|
+
# Authenticate
|
|
28
|
+
cred = ClientSecretCredential(
|
|
29
|
+
domain="auth.konnektr.io",
|
|
30
|
+
audience="https://graph.konnektr.io",
|
|
31
|
+
client_id="YOUR_CLIENT_ID",
|
|
32
|
+
client_secret="YOUR_CLIENT_SECRET"
|
|
33
|
+
)
|
|
34
|
+
|
|
35
|
+
# Initialize Client
|
|
36
|
+
client = KonnektrGraphClient("https://your-graph-endpoint.konnektr.io", cred)
|
|
37
|
+
|
|
38
|
+
# Get a Digital Twin
|
|
39
|
+
twin = client.get_digital_twin("my-twin-id")
|
|
40
|
+
print(twin)
|
|
41
|
+
|
|
42
|
+
# Query Twins with auto-pagination
|
|
43
|
+
for twin in client.query_twins("SELECT * FROM digitaltwins"):
|
|
44
|
+
print(twin)
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### Asynchronous Client
|
|
48
|
+
|
|
49
|
+
```python
|
|
50
|
+
import asyncio
|
|
51
|
+
from konnektr_graph.aio import KonnektrGraphClient
|
|
52
|
+
from konnektr_graph.auth import AsyncClientSecretCredential
|
|
53
|
+
|
|
54
|
+
async def main():
|
|
55
|
+
cred = AsyncClientSecretCredential(
|
|
56
|
+
domain="auth.konnektr.io",
|
|
57
|
+
audience="https://graph.konnektr.io",
|
|
58
|
+
client_id="...",
|
|
59
|
+
client_secret="..."
|
|
60
|
+
)
|
|
61
|
+
|
|
62
|
+
async with KonnektrGraphClient("https://your-graph-endpoint.konnektr.io", cred) as client:
|
|
63
|
+
twin = await client.get_digital_twin("my-twin-id")
|
|
64
|
+
print(twin)
|
|
65
|
+
|
|
66
|
+
asyncio.run(main())
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## Authentication Options
|
|
70
|
+
|
|
71
|
+
- `ClientSecretCredential` / `AsyncClientSecretCredential`: Ideal for server-to-server scenarios.
|
|
72
|
+
- `DeviceCodeCredential` / `AsyncDeviceCodeCredential`: Best for interactive CLI tools.
|
|
73
|
+
- `StaticTokenCredential`: Use when you already have a valid access token.
|
|
74
|
+
|
|
75
|
+
## License
|
|
76
|
+
|
|
77
|
+
This project is licensed under the MIT License - see the LICENSE file for details.
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# konnektr_graph/__init__.py
|
|
2
|
+
"""
|
|
3
|
+
Konnektr Graph SDK (Azure-free).
|
|
4
|
+
"""
|
|
5
|
+
from .client import KonnektrGraphClient
|
|
6
|
+
from .exceptions import (
|
|
7
|
+
KonnektrGraphError,
|
|
8
|
+
HttpResponseError,
|
|
9
|
+
ResourceNotFoundError,
|
|
10
|
+
ResourceExistsError,
|
|
11
|
+
AuthenticationError,
|
|
12
|
+
ValidationError,
|
|
13
|
+
)
|
|
14
|
+
from .models import (
|
|
15
|
+
ImportJob,
|
|
16
|
+
DeleteJob,
|
|
17
|
+
DigitalTwinsModelData,
|
|
18
|
+
IncomingRelationship,
|
|
19
|
+
QueryResult,
|
|
20
|
+
)
|
|
21
|
+
|
|
22
|
+
__all__ = [
|
|
23
|
+
"KonnektrGraphClient",
|
|
24
|
+
"KonnektrGraphError",
|
|
25
|
+
"HttpResponseError",
|
|
26
|
+
"ResourceNotFoundError",
|
|
27
|
+
"ResourceExistsError",
|
|
28
|
+
"AuthenticationError",
|
|
29
|
+
"ValidationError",
|
|
30
|
+
"ImportJob",
|
|
31
|
+
"DeleteJob",
|
|
32
|
+
"DigitalTwinsModelData",
|
|
33
|
+
"IncomingRelationship",
|
|
34
|
+
"QueryResult",
|
|
35
|
+
]
|