klozeo 0.1.0__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.
- klozeo-0.1.0/PKG-INFO +111 -0
- klozeo-0.1.0/README.md +85 -0
- klozeo-0.1.0/klozeo/__init__.py +159 -0
- klozeo-0.1.0/klozeo/_async_client.py +576 -0
- klozeo-0.1.0/klozeo/_client.py +603 -0
- klozeo-0.1.0/klozeo/_errors.py +78 -0
- klozeo-0.1.0/klozeo/_filters.py +550 -0
- klozeo-0.1.0/klozeo/_models.py +526 -0
- klozeo-0.1.0/klozeo/_utils.py +177 -0
- klozeo-0.1.0/pyproject.toml +38 -0
klozeo-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: klozeo
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Official Python SDK for the Klozeo Lead Management API
|
|
5
|
+
Project-URL: Homepage, https://klozeo.com
|
|
6
|
+
Project-URL: Documentation, https://docs.klozeo.com
|
|
7
|
+
Project-URL: Repository, https://github.com/lbframe/sdk-python
|
|
8
|
+
Project-URL: Bug Tracker, https://github.com/lbframe/sdk-python/issues
|
|
9
|
+
Author-email: Klozeo <hello@klozeo.com>
|
|
10
|
+
License: MIT
|
|
11
|
+
Keywords: api,crm,klozeo,leads,sdk
|
|
12
|
+
Classifier: Development Status :: 4 - Beta
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
20
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
21
|
+
Classifier: Typing :: Typed
|
|
22
|
+
Requires-Python: >=3.10
|
|
23
|
+
Requires-Dist: httpx>=0.27
|
|
24
|
+
Requires-Dist: pydantic>=2.0
|
|
25
|
+
Description-Content-Type: text/markdown
|
|
26
|
+
|
|
27
|
+
# Klozeo Python SDK
|
|
28
|
+
|
|
29
|
+
Official Python client for the [Klozeo](https://klozeo.com) Lead Management API.
|
|
30
|
+
|
|
31
|
+
## Installation
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
pip install klozeo
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Requires Python 3.10+.
|
|
38
|
+
|
|
39
|
+
## Quick Start
|
|
40
|
+
|
|
41
|
+
```python
|
|
42
|
+
from klozeo import Klozeo, Lead
|
|
43
|
+
|
|
44
|
+
client = Klozeo("sk_live_your_api_key")
|
|
45
|
+
|
|
46
|
+
# Create a lead
|
|
47
|
+
resp = client.create(Lead(
|
|
48
|
+
name="Acme Corporation",
|
|
49
|
+
source="website",
|
|
50
|
+
city="San Francisco",
|
|
51
|
+
email="contact@acme.com",
|
|
52
|
+
rating=4.5,
|
|
53
|
+
tags=["enterprise", "saas"],
|
|
54
|
+
))
|
|
55
|
+
print(f"Created: {resp.id}")
|
|
56
|
+
|
|
57
|
+
# List with filters
|
|
58
|
+
from klozeo import city, rating, SortField, SortOrder
|
|
59
|
+
|
|
60
|
+
result = client.list(
|
|
61
|
+
city().eq("Berlin"),
|
|
62
|
+
rating().gte(4.0),
|
|
63
|
+
sort_by=SortField.RATING,
|
|
64
|
+
sort_order=SortOrder.DESC,
|
|
65
|
+
limit=20,
|
|
66
|
+
)
|
|
67
|
+
for lead in result.leads:
|
|
68
|
+
print(f"{lead.name} — score: {lead.score}")
|
|
69
|
+
|
|
70
|
+
# Paginate automatically
|
|
71
|
+
for lead in client.iterate(city().eq("Berlin")):
|
|
72
|
+
print(lead.name)
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## Async Client
|
|
76
|
+
|
|
77
|
+
```python
|
|
78
|
+
import asyncio
|
|
79
|
+
from klozeo import AsyncKlozeo, Lead
|
|
80
|
+
|
|
81
|
+
async def main():
|
|
82
|
+
async with AsyncKlozeo("sk_live_your_api_key") as client:
|
|
83
|
+
resp = await client.create(Lead(name="Acme", source="website"))
|
|
84
|
+
async for lead in client.iterate(city().eq("Berlin")):
|
|
85
|
+
print(lead.name)
|
|
86
|
+
|
|
87
|
+
asyncio.run(main())
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
## Error Handling
|
|
91
|
+
|
|
92
|
+
```python
|
|
93
|
+
from klozeo import NotFoundError, RateLimitedError, ForbiddenError, KlozeoError
|
|
94
|
+
|
|
95
|
+
try:
|
|
96
|
+
lead = client.get("cl_nonexistent")
|
|
97
|
+
except NotFoundError:
|
|
98
|
+
print("Lead not found")
|
|
99
|
+
except RateLimitedError as e:
|
|
100
|
+
print(f"Rate limited. Retry after {e.retry_after}s")
|
|
101
|
+
except ForbiddenError:
|
|
102
|
+
print("Leads limit reached — upgrade your plan")
|
|
103
|
+
except KlozeoError as e:
|
|
104
|
+
print(f"HTTP {e.status_code}: {e.message}")
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
## Links
|
|
108
|
+
|
|
109
|
+
- Documentation: https://docs.klozeo.com
|
|
110
|
+
- API Reference: https://docs.klozeo.com/api/leads
|
|
111
|
+
- PyPI: https://pypi.org/project/klozeo
|
klozeo-0.1.0/README.md
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
# Klozeo Python SDK
|
|
2
|
+
|
|
3
|
+
Official Python client for the [Klozeo](https://klozeo.com) Lead Management API.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pip install klozeo
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Requires Python 3.10+.
|
|
12
|
+
|
|
13
|
+
## Quick Start
|
|
14
|
+
|
|
15
|
+
```python
|
|
16
|
+
from klozeo import Klozeo, Lead
|
|
17
|
+
|
|
18
|
+
client = Klozeo("sk_live_your_api_key")
|
|
19
|
+
|
|
20
|
+
# Create a lead
|
|
21
|
+
resp = client.create(Lead(
|
|
22
|
+
name="Acme Corporation",
|
|
23
|
+
source="website",
|
|
24
|
+
city="San Francisco",
|
|
25
|
+
email="contact@acme.com",
|
|
26
|
+
rating=4.5,
|
|
27
|
+
tags=["enterprise", "saas"],
|
|
28
|
+
))
|
|
29
|
+
print(f"Created: {resp.id}")
|
|
30
|
+
|
|
31
|
+
# List with filters
|
|
32
|
+
from klozeo import city, rating, SortField, SortOrder
|
|
33
|
+
|
|
34
|
+
result = client.list(
|
|
35
|
+
city().eq("Berlin"),
|
|
36
|
+
rating().gte(4.0),
|
|
37
|
+
sort_by=SortField.RATING,
|
|
38
|
+
sort_order=SortOrder.DESC,
|
|
39
|
+
limit=20,
|
|
40
|
+
)
|
|
41
|
+
for lead in result.leads:
|
|
42
|
+
print(f"{lead.name} — score: {lead.score}")
|
|
43
|
+
|
|
44
|
+
# Paginate automatically
|
|
45
|
+
for lead in client.iterate(city().eq("Berlin")):
|
|
46
|
+
print(lead.name)
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Async Client
|
|
50
|
+
|
|
51
|
+
```python
|
|
52
|
+
import asyncio
|
|
53
|
+
from klozeo import AsyncKlozeo, Lead
|
|
54
|
+
|
|
55
|
+
async def main():
|
|
56
|
+
async with AsyncKlozeo("sk_live_your_api_key") as client:
|
|
57
|
+
resp = await client.create(Lead(name="Acme", source="website"))
|
|
58
|
+
async for lead in client.iterate(city().eq("Berlin")):
|
|
59
|
+
print(lead.name)
|
|
60
|
+
|
|
61
|
+
asyncio.run(main())
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## Error Handling
|
|
65
|
+
|
|
66
|
+
```python
|
|
67
|
+
from klozeo import NotFoundError, RateLimitedError, ForbiddenError, KlozeoError
|
|
68
|
+
|
|
69
|
+
try:
|
|
70
|
+
lead = client.get("cl_nonexistent")
|
|
71
|
+
except NotFoundError:
|
|
72
|
+
print("Lead not found")
|
|
73
|
+
except RateLimitedError as e:
|
|
74
|
+
print(f"Rate limited. Retry after {e.retry_after}s")
|
|
75
|
+
except ForbiddenError:
|
|
76
|
+
print("Leads limit reached — upgrade your plan")
|
|
77
|
+
except KlozeoError as e:
|
|
78
|
+
print(f"HTTP {e.status_code}: {e.message}")
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
## Links
|
|
82
|
+
|
|
83
|
+
- Documentation: https://docs.klozeo.com
|
|
84
|
+
- API Reference: https://docs.klozeo.com/api/leads
|
|
85
|
+
- PyPI: https://pypi.org/project/klozeo
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
"""Klozeo Python SDK.
|
|
2
|
+
|
|
3
|
+
Official Python client for the Klozeo Lead Management API.
|
|
4
|
+
|
|
5
|
+
Quick start::
|
|
6
|
+
|
|
7
|
+
from klozeo import Klozeo, Lead
|
|
8
|
+
|
|
9
|
+
client = Klozeo("sk_live_your_api_key")
|
|
10
|
+
|
|
11
|
+
# Create a lead
|
|
12
|
+
resp = client.create(Lead(name="Acme Corporation", source="website"))
|
|
13
|
+
print(f"Created: {resp.id}")
|
|
14
|
+
|
|
15
|
+
# List with filters
|
|
16
|
+
from klozeo import city, rating, SortField, SortOrder
|
|
17
|
+
|
|
18
|
+
result = client.list(
|
|
19
|
+
city().eq("Berlin"),
|
|
20
|
+
rating().gte(4.0),
|
|
21
|
+
sort_by=SortField.RATING,
|
|
22
|
+
sort_order=SortOrder.DESC,
|
|
23
|
+
limit=20,
|
|
24
|
+
)
|
|
25
|
+
|
|
26
|
+
# Iterate all pages automatically
|
|
27
|
+
for lead in client.iterate(city().eq("Berlin")):
|
|
28
|
+
print(lead.name)
|
|
29
|
+
|
|
30
|
+
Async client::
|
|
31
|
+
|
|
32
|
+
import asyncio
|
|
33
|
+
from klozeo import AsyncKlozeo, Lead
|
|
34
|
+
|
|
35
|
+
async def main():
|
|
36
|
+
async with AsyncKlozeo("sk_live_your_api_key") as client:
|
|
37
|
+
resp = await client.create(Lead(name="Acme", source="website"))
|
|
38
|
+
|
|
39
|
+
asyncio.run(main())
|
|
40
|
+
"""
|
|
41
|
+
|
|
42
|
+
from ._async_client import AsyncKlozeo
|
|
43
|
+
from ._client import Klozeo
|
|
44
|
+
from ._errors import (
|
|
45
|
+
BadRequestError,
|
|
46
|
+
ForbiddenError,
|
|
47
|
+
KlozeoError,
|
|
48
|
+
NotFoundError,
|
|
49
|
+
RateLimitedError,
|
|
50
|
+
UnauthorizedError,
|
|
51
|
+
ValidationError,
|
|
52
|
+
)
|
|
53
|
+
from ._filters import (
|
|
54
|
+
Filter,
|
|
55
|
+
attr,
|
|
56
|
+
attr_sort_field,
|
|
57
|
+
category,
|
|
58
|
+
city,
|
|
59
|
+
country,
|
|
60
|
+
email,
|
|
61
|
+
location,
|
|
62
|
+
name,
|
|
63
|
+
or_,
|
|
64
|
+
phone,
|
|
65
|
+
rating,
|
|
66
|
+
review_count,
|
|
67
|
+
source,
|
|
68
|
+
state,
|
|
69
|
+
tags,
|
|
70
|
+
website,
|
|
71
|
+
)
|
|
72
|
+
from ._models import (
|
|
73
|
+
Attribute,
|
|
74
|
+
BatchCreateResult,
|
|
75
|
+
BatchCreatedItem,
|
|
76
|
+
BatchError,
|
|
77
|
+
BatchResult,
|
|
78
|
+
BatchResultItem,
|
|
79
|
+
CreateResponse,
|
|
80
|
+
ExportFormat,
|
|
81
|
+
Lead,
|
|
82
|
+
ListOptions,
|
|
83
|
+
ListResult,
|
|
84
|
+
Note,
|
|
85
|
+
ScoringRule,
|
|
86
|
+
ScoringRuleInput,
|
|
87
|
+
SortField,
|
|
88
|
+
SortOrder,
|
|
89
|
+
UpdateLeadInput,
|
|
90
|
+
Webhook,
|
|
91
|
+
WebhookInput,
|
|
92
|
+
bool_attr,
|
|
93
|
+
list_attr,
|
|
94
|
+
number_attr,
|
|
95
|
+
object_attr,
|
|
96
|
+
text_attr,
|
|
97
|
+
)
|
|
98
|
+
|
|
99
|
+
__all__ = [
|
|
100
|
+
# Clients
|
|
101
|
+
"Klozeo",
|
|
102
|
+
"AsyncKlozeo",
|
|
103
|
+
# Models
|
|
104
|
+
"Lead",
|
|
105
|
+
"UpdateLeadInput",
|
|
106
|
+
"Note",
|
|
107
|
+
"Attribute",
|
|
108
|
+
"ScoringRule",
|
|
109
|
+
"ScoringRuleInput",
|
|
110
|
+
"Webhook",
|
|
111
|
+
"WebhookInput",
|
|
112
|
+
"CreateResponse",
|
|
113
|
+
"ListResult",
|
|
114
|
+
"BatchResult",
|
|
115
|
+
"BatchCreateResult",
|
|
116
|
+
"BatchCreatedItem",
|
|
117
|
+
"BatchError",
|
|
118
|
+
"BatchResultItem",
|
|
119
|
+
# Enums
|
|
120
|
+
"ExportFormat",
|
|
121
|
+
"SortField",
|
|
122
|
+
"SortOrder",
|
|
123
|
+
# Query builder
|
|
124
|
+
"ListOptions",
|
|
125
|
+
"Filter",
|
|
126
|
+
# Filter factory functions
|
|
127
|
+
"city",
|
|
128
|
+
"name",
|
|
129
|
+
"country",
|
|
130
|
+
"state",
|
|
131
|
+
"category",
|
|
132
|
+
"source",
|
|
133
|
+
"email",
|
|
134
|
+
"phone",
|
|
135
|
+
"website",
|
|
136
|
+
"rating",
|
|
137
|
+
"review_count",
|
|
138
|
+
"tags",
|
|
139
|
+
"location",
|
|
140
|
+
"attr",
|
|
141
|
+
"or_",
|
|
142
|
+
"attr_sort_field",
|
|
143
|
+
# Attribute helpers
|
|
144
|
+
"text_attr",
|
|
145
|
+
"number_attr",
|
|
146
|
+
"bool_attr",
|
|
147
|
+
"list_attr",
|
|
148
|
+
"object_attr",
|
|
149
|
+
# Errors
|
|
150
|
+
"KlozeoError",
|
|
151
|
+
"NotFoundError",
|
|
152
|
+
"UnauthorizedError",
|
|
153
|
+
"ForbiddenError",
|
|
154
|
+
"RateLimitedError",
|
|
155
|
+
"BadRequestError",
|
|
156
|
+
"ValidationError",
|
|
157
|
+
]
|
|
158
|
+
|
|
159
|
+
__version__ = "0.1.0"
|