python-zendesk-sdk 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.
- python_zendesk_sdk-0.1.0/.flake8 +23 -0
- python_zendesk_sdk-0.1.0/.github/workflows/publish.yml +44 -0
- python_zendesk_sdk-0.1.0/.gitignore +192 -0
- python_zendesk_sdk-0.1.0/.python-version +1 -0
- python_zendesk_sdk-0.1.0/LICENSE +21 -0
- python_zendesk_sdk-0.1.0/PKG-INFO +218 -0
- python_zendesk_sdk-0.1.0/README.md +181 -0
- python_zendesk_sdk-0.1.0/pyproject.toml +145 -0
- python_zendesk_sdk-0.1.0/src/zendesk_sdk/__init__.py +28 -0
- python_zendesk_sdk-0.1.0/src/zendesk_sdk/client.py +321 -0
- python_zendesk_sdk-0.1.0/src/zendesk_sdk/config.py +111 -0
- python_zendesk_sdk-0.1.0/src/zendesk_sdk/exceptions.py +178 -0
- python_zendesk_sdk-0.1.0/src/zendesk_sdk/http_client.py +256 -0
- python_zendesk_sdk-0.1.0/src/zendesk_sdk/models/__init__.py +40 -0
- python_zendesk_sdk-0.1.0/src/zendesk_sdk/models/base.py +50 -0
- python_zendesk_sdk-0.1.0/src/zendesk_sdk/models/comment.py +62 -0
- python_zendesk_sdk-0.1.0/src/zendesk_sdk/models/organization.py +59 -0
- python_zendesk_sdk-0.1.0/src/zendesk_sdk/models/ticket.py +169 -0
- python_zendesk_sdk-0.1.0/src/zendesk_sdk/models/user.py +107 -0
- python_zendesk_sdk-0.1.0/src/zendesk_sdk/pagination.py +296 -0
- python_zendesk_sdk-0.1.0/tests/__init__.py +1 -0
- python_zendesk_sdk-0.1.0/tests/test_client.py +439 -0
- python_zendesk_sdk-0.1.0/tests/test_config.py +52 -0
- python_zendesk_sdk-0.1.0/tests/test_exceptions.py +223 -0
- python_zendesk_sdk-0.1.0/tests/test_http_client.py +186 -0
- python_zendesk_sdk-0.1.0/tests/test_models.py +443 -0
- python_zendesk_sdk-0.1.0/tests/test_package_import.py +65 -0
- python_zendesk_sdk-0.1.0/tests/test_pagination.py +481 -0
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
[flake8]
|
|
2
|
+
max-line-length = 120
|
|
3
|
+
extend-ignore =
|
|
4
|
+
# E203: whitespace before ':'
|
|
5
|
+
E203,
|
|
6
|
+
# W503: line break before binary operator
|
|
7
|
+
W503,
|
|
8
|
+
# E501: line too long (handled by black)
|
|
9
|
+
E501
|
|
10
|
+
exclude =
|
|
11
|
+
.git,
|
|
12
|
+
__pycache__,
|
|
13
|
+
.venv,
|
|
14
|
+
venv,
|
|
15
|
+
build,
|
|
16
|
+
dist,
|
|
17
|
+
*.egg-info,
|
|
18
|
+
.pytest_cache,
|
|
19
|
+
.mypy_cache,
|
|
20
|
+
proto/
|
|
21
|
+
per-file-ignores =
|
|
22
|
+
__init__.py:F401
|
|
23
|
+
max-complexity = 10
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
name: Publish to PyPI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
release:
|
|
5
|
+
types: [published]
|
|
6
|
+
|
|
7
|
+
jobs:
|
|
8
|
+
build:
|
|
9
|
+
runs-on: ubuntu-latest
|
|
10
|
+
steps:
|
|
11
|
+
- uses: actions/checkout@v4
|
|
12
|
+
|
|
13
|
+
- name: Set up Python
|
|
14
|
+
uses: actions/setup-python@v5
|
|
15
|
+
with:
|
|
16
|
+
python-version: "3.11"
|
|
17
|
+
|
|
18
|
+
- name: Install build dependencies
|
|
19
|
+
run: python -m pip install --upgrade pip build
|
|
20
|
+
|
|
21
|
+
- name: Build package
|
|
22
|
+
run: python -m build
|
|
23
|
+
|
|
24
|
+
- name: Upload artifacts
|
|
25
|
+
uses: actions/upload-artifact@v4
|
|
26
|
+
with:
|
|
27
|
+
name: dist
|
|
28
|
+
path: dist/
|
|
29
|
+
|
|
30
|
+
publish:
|
|
31
|
+
needs: build
|
|
32
|
+
runs-on: ubuntu-latest
|
|
33
|
+
environment: pypi
|
|
34
|
+
permissions:
|
|
35
|
+
id-token: write
|
|
36
|
+
steps:
|
|
37
|
+
- name: Download artifacts
|
|
38
|
+
uses: actions/download-artifact@v4
|
|
39
|
+
with:
|
|
40
|
+
name: dist
|
|
41
|
+
path: dist/
|
|
42
|
+
|
|
43
|
+
- name: Publish to PyPI
|
|
44
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
|
|
6
|
+
# C extensions
|
|
7
|
+
*.so
|
|
8
|
+
|
|
9
|
+
# Distribution / packaging
|
|
10
|
+
.Python
|
|
11
|
+
build/
|
|
12
|
+
develop-eggs/
|
|
13
|
+
dist/
|
|
14
|
+
downloads/
|
|
15
|
+
eggs/
|
|
16
|
+
.eggs/
|
|
17
|
+
lib/
|
|
18
|
+
lib64/
|
|
19
|
+
parts/
|
|
20
|
+
sdist/
|
|
21
|
+
var/
|
|
22
|
+
wheels/
|
|
23
|
+
share/python-wheels/
|
|
24
|
+
*.egg-info/
|
|
25
|
+
.installed.cfg
|
|
26
|
+
*.egg
|
|
27
|
+
MANIFEST
|
|
28
|
+
|
|
29
|
+
# PyInstaller
|
|
30
|
+
# Usually these files are written by a python script from a template
|
|
31
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
32
|
+
*.manifest
|
|
33
|
+
*.spec
|
|
34
|
+
|
|
35
|
+
# Installer logs
|
|
36
|
+
pip-log.txt
|
|
37
|
+
pip-delete-this-directory.txt
|
|
38
|
+
|
|
39
|
+
# Unit test / coverage reports
|
|
40
|
+
htmlcov/
|
|
41
|
+
.tox/
|
|
42
|
+
.nox/
|
|
43
|
+
.coverage
|
|
44
|
+
.coverage.*
|
|
45
|
+
.cache
|
|
46
|
+
nosetests.xml
|
|
47
|
+
coverage.xml
|
|
48
|
+
*.cover
|
|
49
|
+
*.py,cover
|
|
50
|
+
.hypothesis/
|
|
51
|
+
.pytest_cache/
|
|
52
|
+
cover/
|
|
53
|
+
|
|
54
|
+
# Translations
|
|
55
|
+
*.mo
|
|
56
|
+
*.pot
|
|
57
|
+
|
|
58
|
+
# Django stuff:
|
|
59
|
+
*.log
|
|
60
|
+
local_settings.py
|
|
61
|
+
db.sqlite3
|
|
62
|
+
db.sqlite3-journal
|
|
63
|
+
|
|
64
|
+
# Flask stuff:
|
|
65
|
+
instance/
|
|
66
|
+
.webassets-cache
|
|
67
|
+
|
|
68
|
+
# Scrapy stuff:
|
|
69
|
+
.scrapy
|
|
70
|
+
|
|
71
|
+
# Sphinx documentation
|
|
72
|
+
docs/_build/
|
|
73
|
+
|
|
74
|
+
# PyBuilder
|
|
75
|
+
.pybuilder/
|
|
76
|
+
target/
|
|
77
|
+
|
|
78
|
+
# Jupyter Notebook
|
|
79
|
+
.ipynb_checkpoints
|
|
80
|
+
|
|
81
|
+
# IPython
|
|
82
|
+
profile_default/
|
|
83
|
+
ipython_config.py
|
|
84
|
+
|
|
85
|
+
# pyenv
|
|
86
|
+
# For a library or package, you might want to ignore these files since the code is
|
|
87
|
+
# intended to run in multiple environments; otherwise, check them in:
|
|
88
|
+
# .python-version
|
|
89
|
+
|
|
90
|
+
# pipenv
|
|
91
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
92
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
93
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
94
|
+
# install all needed dependencies.
|
|
95
|
+
#Pipfile.lock
|
|
96
|
+
|
|
97
|
+
# poetry
|
|
98
|
+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
|
99
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
100
|
+
# commonly ignored for libraries.
|
|
101
|
+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
|
102
|
+
#poetry.lock
|
|
103
|
+
|
|
104
|
+
# pdm
|
|
105
|
+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
|
106
|
+
#pdm.lock
|
|
107
|
+
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
|
|
108
|
+
# in version control.
|
|
109
|
+
# https://pdm.fming.dev/#use-with-ide
|
|
110
|
+
.pdm.toml
|
|
111
|
+
|
|
112
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
|
113
|
+
__pypackages__/
|
|
114
|
+
|
|
115
|
+
# Celery stuff
|
|
116
|
+
celerybeat-schedule
|
|
117
|
+
celerybeat.pid
|
|
118
|
+
|
|
119
|
+
# SageMath parsed files
|
|
120
|
+
*.sage.py
|
|
121
|
+
|
|
122
|
+
# Environments
|
|
123
|
+
.env
|
|
124
|
+
.venv
|
|
125
|
+
env/
|
|
126
|
+
venv/
|
|
127
|
+
ENV/
|
|
128
|
+
env.bak/
|
|
129
|
+
venv.bak/
|
|
130
|
+
|
|
131
|
+
# Spyder project settings
|
|
132
|
+
.spyderproject
|
|
133
|
+
.spyproject
|
|
134
|
+
|
|
135
|
+
# Rope project settings
|
|
136
|
+
.ropeproject
|
|
137
|
+
|
|
138
|
+
# mkdocs documentation
|
|
139
|
+
/site
|
|
140
|
+
|
|
141
|
+
# mypy
|
|
142
|
+
.mypy_cache/
|
|
143
|
+
.dmypy.json
|
|
144
|
+
dmypy.json
|
|
145
|
+
|
|
146
|
+
# Pyre type checker
|
|
147
|
+
.pyre/
|
|
148
|
+
|
|
149
|
+
# pytype static type analyzer
|
|
150
|
+
.pytype/
|
|
151
|
+
|
|
152
|
+
# Cython debug symbols
|
|
153
|
+
cython_debug/
|
|
154
|
+
|
|
155
|
+
# PyCharm
|
|
156
|
+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
|
157
|
+
# be added to the global gitignore or merged into this project gitignore. For a PyCharm
|
|
158
|
+
# project, it is recommended to ignore the entire idea/ directory.
|
|
159
|
+
.idea/
|
|
160
|
+
|
|
161
|
+
# VS Code
|
|
162
|
+
.vscode/
|
|
163
|
+
|
|
164
|
+
# pyenv - keep .python-version in git for consistent development environment
|
|
165
|
+
# (already handled in pyenv section above)
|
|
166
|
+
|
|
167
|
+
# UV - not used in this project
|
|
168
|
+
.uv/
|
|
169
|
+
uv.lock
|
|
170
|
+
|
|
171
|
+
# OS generated files
|
|
172
|
+
.DS_Store
|
|
173
|
+
.DS_Store?
|
|
174
|
+
._*
|
|
175
|
+
.Spotlight-V100
|
|
176
|
+
.Trashes
|
|
177
|
+
ehthumbs.db
|
|
178
|
+
Thumbs.db
|
|
179
|
+
|
|
180
|
+
# Temporary files
|
|
181
|
+
*.tmp
|
|
182
|
+
*.temp
|
|
183
|
+
*.swp
|
|
184
|
+
*.swo
|
|
185
|
+
*~
|
|
186
|
+
|
|
187
|
+
# Debug files
|
|
188
|
+
debug.py
|
|
189
|
+
|
|
190
|
+
# Local directories
|
|
191
|
+
.claude/
|
|
192
|
+
llm/
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
python-zendesk-sdk
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 bormog
|
|
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,218 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: python-zendesk-sdk
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Modern Python SDK for Zendesk API
|
|
5
|
+
Project-URL: Homepage, https://github.com/bormog/python-zendesk-sdk
|
|
6
|
+
Project-URL: Repository, https://github.com/bormog/python-zendesk-sdk
|
|
7
|
+
Project-URL: Issues, https://github.com/bormog/python-zendesk-sdk/issues
|
|
8
|
+
Author: bormog
|
|
9
|
+
License: MIT
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Keywords: api,client,sdk,zendesk
|
|
12
|
+
Classifier: Development Status :: 3 - Alpha
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
15
|
+
Classifier: Operating System :: OS Independent
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
22
|
+
Classifier: Topic :: Internet :: WWW/HTTP
|
|
23
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
24
|
+
Requires-Python: >=3.8.1
|
|
25
|
+
Requires-Dist: httpx>=0.25.0
|
|
26
|
+
Requires-Dist: pydantic>=2.0.0
|
|
27
|
+
Provides-Extra: dev
|
|
28
|
+
Requires-Dist: black>=23.0.0; extra == 'dev'
|
|
29
|
+
Requires-Dist: flake8>=6.0.0; extra == 'dev'
|
|
30
|
+
Requires-Dist: isort>=5.12.0; extra == 'dev'
|
|
31
|
+
Requires-Dist: mypy>=1.5.0; extra == 'dev'
|
|
32
|
+
Requires-Dist: pre-commit>=3.0.0; extra == 'dev'
|
|
33
|
+
Requires-Dist: pytest-asyncio>=0.21.0; extra == 'dev'
|
|
34
|
+
Requires-Dist: pytest-cov>=4.0.0; extra == 'dev'
|
|
35
|
+
Requires-Dist: pytest>=7.0.0; extra == 'dev'
|
|
36
|
+
Description-Content-Type: text/markdown
|
|
37
|
+
|
|
38
|
+
# Python Zendesk SDK
|
|
39
|
+
|
|
40
|
+
Modern Python SDK for Zendesk API with async support, full type safety, and comprehensive error handling.
|
|
41
|
+
|
|
42
|
+
## Status: Ready for Read-Only Operations ✅
|
|
43
|
+
|
|
44
|
+
This project has completed iterations 1-4 and is ready for production use in read-only mode.
|
|
45
|
+
|
|
46
|
+
### Completed Features ✅
|
|
47
|
+
|
|
48
|
+
- **Project Infrastructure**: Complete setup with `pyproject.toml`, dependencies, and linting
|
|
49
|
+
- **Configuration System**: `ZendeskConfig` with environment variable support and validation
|
|
50
|
+
- **Exception Handling**: Comprehensive exception hierarchy for different error types
|
|
51
|
+
- **HTTP Client**: Async HTTP client with retry logic, rate limiting, and exponential backoff
|
|
52
|
+
- **Pagination**: Both offset-based and cursor-based pagination support
|
|
53
|
+
- **Data Models**: Full Pydantic v2 models for Users, Organizations, Tickets, and Comments
|
|
54
|
+
- **Read API Methods**: 13 methods for reading data from Zendesk
|
|
55
|
+
- Users: `get_users()`, `get_user()`, `get_user_by_email()`
|
|
56
|
+
- Organizations: `get_organizations()`, `get_organization()`
|
|
57
|
+
- Tickets: `get_tickets()`, `get_ticket()`, `get_user_tickets()`, `get_organization_tickets()`
|
|
58
|
+
- Comments: `get_ticket_comments()`
|
|
59
|
+
- Search: `search()`, `search_users()`, `search_tickets()`, `search_organizations()`
|
|
60
|
+
- **Testing Framework**: Full test suite with 128+ passing tests
|
|
61
|
+
- **Code Quality**: Black, isort, flake8, and mypy configured
|
|
62
|
+
|
|
63
|
+
### In Development 🚧
|
|
64
|
+
|
|
65
|
+
- Write operations (create/update/delete) - planned for future iteration
|
|
66
|
+
- Documentation & Examples (Iteration 5)
|
|
67
|
+
|
|
68
|
+
## Installation
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
# Install from PyPI (when published)
|
|
72
|
+
pip install python-zendesk-sdk
|
|
73
|
+
|
|
74
|
+
# Or install from source
|
|
75
|
+
git clone <repository-url>
|
|
76
|
+
cd python-zendesk-sdk
|
|
77
|
+
pip install -e ".[dev]"
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
## Quick Start
|
|
81
|
+
|
|
82
|
+
```python
|
|
83
|
+
import asyncio
|
|
84
|
+
from zendesk_sdk import ZendeskClient, ZendeskConfig
|
|
85
|
+
|
|
86
|
+
async def main():
|
|
87
|
+
# Create configuration
|
|
88
|
+
config = ZendeskConfig(
|
|
89
|
+
subdomain="your-subdomain",
|
|
90
|
+
email="your-email@example.com",
|
|
91
|
+
token="your-api-token", # or use password="your-password"
|
|
92
|
+
)
|
|
93
|
+
|
|
94
|
+
# Use async context manager
|
|
95
|
+
async with ZendeskClient(config) as client:
|
|
96
|
+
# Get users with pagination
|
|
97
|
+
users_paginator = await client.get_users(per_page=10)
|
|
98
|
+
users = await users_paginator.get_page()
|
|
99
|
+
|
|
100
|
+
for user in users:
|
|
101
|
+
print(f"User: {user.name} ({user.email})")
|
|
102
|
+
|
|
103
|
+
# Get specific ticket
|
|
104
|
+
ticket = await client.get_ticket(ticket_id=12345)
|
|
105
|
+
print(f"Ticket: {ticket.subject}")
|
|
106
|
+
|
|
107
|
+
# Search tickets
|
|
108
|
+
results = await client.search_tickets("status:open priority:high")
|
|
109
|
+
for ticket in results:
|
|
110
|
+
print(f"High priority: {ticket.subject}")
|
|
111
|
+
|
|
112
|
+
asyncio.run(main())
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
## Configuration
|
|
116
|
+
|
|
117
|
+
The SDK supports multiple ways to configure authentication:
|
|
118
|
+
|
|
119
|
+
### 1. Direct instantiation
|
|
120
|
+
```python
|
|
121
|
+
config = ZendeskConfig(
|
|
122
|
+
subdomain="mycompany",
|
|
123
|
+
email="user@example.com",
|
|
124
|
+
token="api_token_here"
|
|
125
|
+
)
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
### 2. Environment variables
|
|
129
|
+
```bash
|
|
130
|
+
export ZENDESK_SUBDOMAIN=mycompany
|
|
131
|
+
export ZENDESK_EMAIL=user@example.com
|
|
132
|
+
export ZENDESK_TOKEN=api_token_here
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
```python
|
|
136
|
+
config = ZendeskConfig() # Will load from environment
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
### 3. Mixed approach
|
|
140
|
+
```python
|
|
141
|
+
# Override specific values, rest from environment
|
|
142
|
+
config = ZendeskConfig(subdomain="different-subdomain")
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
## Development
|
|
146
|
+
|
|
147
|
+
### Running Tests
|
|
148
|
+
|
|
149
|
+
```bash
|
|
150
|
+
# Run all tests
|
|
151
|
+
pytest
|
|
152
|
+
|
|
153
|
+
# Run with coverage
|
|
154
|
+
pytest --cov=src/zendesk_sdk --cov-report=html
|
|
155
|
+
|
|
156
|
+
# Run specific test file
|
|
157
|
+
pytest tests/test_config.py -v
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
### Code Quality
|
|
161
|
+
|
|
162
|
+
```bash
|
|
163
|
+
# Format code
|
|
164
|
+
python -m black src tests
|
|
165
|
+
python -m isort src tests
|
|
166
|
+
|
|
167
|
+
# Lint code
|
|
168
|
+
python -m flake8 src tests
|
|
169
|
+
|
|
170
|
+
# Type checking
|
|
171
|
+
python -m mypy src
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
### Running All Checks
|
|
175
|
+
|
|
176
|
+
```bash
|
|
177
|
+
# Format, lint, and test
|
|
178
|
+
python -m black src tests && python -m isort src tests && python -m flake8 src tests && python -m mypy src && pytest
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
## Project Structure
|
|
182
|
+
|
|
183
|
+
```
|
|
184
|
+
├── src/zendesk_sdk/ # Main package
|
|
185
|
+
│ ├── __init__.py # Public API exports
|
|
186
|
+
│ ├── client.py # Main ZendeskClient class
|
|
187
|
+
│ ├── config.py # Configuration management
|
|
188
|
+
│ ├── exceptions.py # Exception hierarchy
|
|
189
|
+
│ └── models/ # Data models
|
|
190
|
+
│ ├── __init__.py
|
|
191
|
+
│ └── base.py # Base model class
|
|
192
|
+
├── tests/ # Test suite
|
|
193
|
+
├── pyproject.toml # Project configuration
|
|
194
|
+
└── README.md # This file
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
## Requirements
|
|
198
|
+
|
|
199
|
+
- Python 3.8+
|
|
200
|
+
- httpx (for async HTTP client)
|
|
201
|
+
- pydantic >=2.0 (for data validation)
|
|
202
|
+
|
|
203
|
+
## Development Roadmap
|
|
204
|
+
|
|
205
|
+
- [x] **Iteration 1**: Infrastructure Setup
|
|
206
|
+
- [x] **Iteration 2**: HTTP Client & Pagination
|
|
207
|
+
- [x] **Iteration 3**: Data Models (Users, Tickets, Organizations, Comments)
|
|
208
|
+
- [x] **Iteration 4**: Read-Only API Methods & Search
|
|
209
|
+
- [ ] **Iteration 5**: Documentation & Examples (in progress)
|
|
210
|
+
- [ ] **Future**: Write operations (create/update/delete)
|
|
211
|
+
|
|
212
|
+
## License
|
|
213
|
+
|
|
214
|
+
MIT License - see LICENSE file for details.
|
|
215
|
+
|
|
216
|
+
## Contributing
|
|
217
|
+
|
|
218
|
+
This project is currently in early development. Contribution guidelines will be added in future iterations.
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
# Python Zendesk SDK
|
|
2
|
+
|
|
3
|
+
Modern Python SDK for Zendesk API with async support, full type safety, and comprehensive error handling.
|
|
4
|
+
|
|
5
|
+
## Status: Ready for Read-Only Operations ✅
|
|
6
|
+
|
|
7
|
+
This project has completed iterations 1-4 and is ready for production use in read-only mode.
|
|
8
|
+
|
|
9
|
+
### Completed Features ✅
|
|
10
|
+
|
|
11
|
+
- **Project Infrastructure**: Complete setup with `pyproject.toml`, dependencies, and linting
|
|
12
|
+
- **Configuration System**: `ZendeskConfig` with environment variable support and validation
|
|
13
|
+
- **Exception Handling**: Comprehensive exception hierarchy for different error types
|
|
14
|
+
- **HTTP Client**: Async HTTP client with retry logic, rate limiting, and exponential backoff
|
|
15
|
+
- **Pagination**: Both offset-based and cursor-based pagination support
|
|
16
|
+
- **Data Models**: Full Pydantic v2 models for Users, Organizations, Tickets, and Comments
|
|
17
|
+
- **Read API Methods**: 13 methods for reading data from Zendesk
|
|
18
|
+
- Users: `get_users()`, `get_user()`, `get_user_by_email()`
|
|
19
|
+
- Organizations: `get_organizations()`, `get_organization()`
|
|
20
|
+
- Tickets: `get_tickets()`, `get_ticket()`, `get_user_tickets()`, `get_organization_tickets()`
|
|
21
|
+
- Comments: `get_ticket_comments()`
|
|
22
|
+
- Search: `search()`, `search_users()`, `search_tickets()`, `search_organizations()`
|
|
23
|
+
- **Testing Framework**: Full test suite with 128+ passing tests
|
|
24
|
+
- **Code Quality**: Black, isort, flake8, and mypy configured
|
|
25
|
+
|
|
26
|
+
### In Development 🚧
|
|
27
|
+
|
|
28
|
+
- Write operations (create/update/delete) - planned for future iteration
|
|
29
|
+
- Documentation & Examples (Iteration 5)
|
|
30
|
+
|
|
31
|
+
## Installation
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
# Install from PyPI (when published)
|
|
35
|
+
pip install python-zendesk-sdk
|
|
36
|
+
|
|
37
|
+
# Or install from source
|
|
38
|
+
git clone <repository-url>
|
|
39
|
+
cd python-zendesk-sdk
|
|
40
|
+
pip install -e ".[dev]"
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Quick Start
|
|
44
|
+
|
|
45
|
+
```python
|
|
46
|
+
import asyncio
|
|
47
|
+
from zendesk_sdk import ZendeskClient, ZendeskConfig
|
|
48
|
+
|
|
49
|
+
async def main():
|
|
50
|
+
# Create configuration
|
|
51
|
+
config = ZendeskConfig(
|
|
52
|
+
subdomain="your-subdomain",
|
|
53
|
+
email="your-email@example.com",
|
|
54
|
+
token="your-api-token", # or use password="your-password"
|
|
55
|
+
)
|
|
56
|
+
|
|
57
|
+
# Use async context manager
|
|
58
|
+
async with ZendeskClient(config) as client:
|
|
59
|
+
# Get users with pagination
|
|
60
|
+
users_paginator = await client.get_users(per_page=10)
|
|
61
|
+
users = await users_paginator.get_page()
|
|
62
|
+
|
|
63
|
+
for user in users:
|
|
64
|
+
print(f"User: {user.name} ({user.email})")
|
|
65
|
+
|
|
66
|
+
# Get specific ticket
|
|
67
|
+
ticket = await client.get_ticket(ticket_id=12345)
|
|
68
|
+
print(f"Ticket: {ticket.subject}")
|
|
69
|
+
|
|
70
|
+
# Search tickets
|
|
71
|
+
results = await client.search_tickets("status:open priority:high")
|
|
72
|
+
for ticket in results:
|
|
73
|
+
print(f"High priority: {ticket.subject}")
|
|
74
|
+
|
|
75
|
+
asyncio.run(main())
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## Configuration
|
|
79
|
+
|
|
80
|
+
The SDK supports multiple ways to configure authentication:
|
|
81
|
+
|
|
82
|
+
### 1. Direct instantiation
|
|
83
|
+
```python
|
|
84
|
+
config = ZendeskConfig(
|
|
85
|
+
subdomain="mycompany",
|
|
86
|
+
email="user@example.com",
|
|
87
|
+
token="api_token_here"
|
|
88
|
+
)
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
### 2. Environment variables
|
|
92
|
+
```bash
|
|
93
|
+
export ZENDESK_SUBDOMAIN=mycompany
|
|
94
|
+
export ZENDESK_EMAIL=user@example.com
|
|
95
|
+
export ZENDESK_TOKEN=api_token_here
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
```python
|
|
99
|
+
config = ZendeskConfig() # Will load from environment
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
### 3. Mixed approach
|
|
103
|
+
```python
|
|
104
|
+
# Override specific values, rest from environment
|
|
105
|
+
config = ZendeskConfig(subdomain="different-subdomain")
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
## Development
|
|
109
|
+
|
|
110
|
+
### Running Tests
|
|
111
|
+
|
|
112
|
+
```bash
|
|
113
|
+
# Run all tests
|
|
114
|
+
pytest
|
|
115
|
+
|
|
116
|
+
# Run with coverage
|
|
117
|
+
pytest --cov=src/zendesk_sdk --cov-report=html
|
|
118
|
+
|
|
119
|
+
# Run specific test file
|
|
120
|
+
pytest tests/test_config.py -v
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
### Code Quality
|
|
124
|
+
|
|
125
|
+
```bash
|
|
126
|
+
# Format code
|
|
127
|
+
python -m black src tests
|
|
128
|
+
python -m isort src tests
|
|
129
|
+
|
|
130
|
+
# Lint code
|
|
131
|
+
python -m flake8 src tests
|
|
132
|
+
|
|
133
|
+
# Type checking
|
|
134
|
+
python -m mypy src
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
### Running All Checks
|
|
138
|
+
|
|
139
|
+
```bash
|
|
140
|
+
# Format, lint, and test
|
|
141
|
+
python -m black src tests && python -m isort src tests && python -m flake8 src tests && python -m mypy src && pytest
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
## Project Structure
|
|
145
|
+
|
|
146
|
+
```
|
|
147
|
+
├── src/zendesk_sdk/ # Main package
|
|
148
|
+
│ ├── __init__.py # Public API exports
|
|
149
|
+
│ ├── client.py # Main ZendeskClient class
|
|
150
|
+
│ ├── config.py # Configuration management
|
|
151
|
+
│ ├── exceptions.py # Exception hierarchy
|
|
152
|
+
│ └── models/ # Data models
|
|
153
|
+
│ ├── __init__.py
|
|
154
|
+
│ └── base.py # Base model class
|
|
155
|
+
├── tests/ # Test suite
|
|
156
|
+
├── pyproject.toml # Project configuration
|
|
157
|
+
└── README.md # This file
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
## Requirements
|
|
161
|
+
|
|
162
|
+
- Python 3.8+
|
|
163
|
+
- httpx (for async HTTP client)
|
|
164
|
+
- pydantic >=2.0 (for data validation)
|
|
165
|
+
|
|
166
|
+
## Development Roadmap
|
|
167
|
+
|
|
168
|
+
- [x] **Iteration 1**: Infrastructure Setup
|
|
169
|
+
- [x] **Iteration 2**: HTTP Client & Pagination
|
|
170
|
+
- [x] **Iteration 3**: Data Models (Users, Tickets, Organizations, Comments)
|
|
171
|
+
- [x] **Iteration 4**: Read-Only API Methods & Search
|
|
172
|
+
- [ ] **Iteration 5**: Documentation & Examples (in progress)
|
|
173
|
+
- [ ] **Future**: Write operations (create/update/delete)
|
|
174
|
+
|
|
175
|
+
## License
|
|
176
|
+
|
|
177
|
+
MIT License - see LICENSE file for details.
|
|
178
|
+
|
|
179
|
+
## Contributing
|
|
180
|
+
|
|
181
|
+
This project is currently in early development. Contribution guidelines will be added in future iterations.
|