intelliprint-py 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.
@@ -0,0 +1,86 @@
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
+ *.manifest
31
+ *.spec
32
+
33
+ # Installer logs
34
+ pip-log.txt
35
+ pip-delete-this-directory.txt
36
+
37
+ # Unit test / coverage reports
38
+ htmlcov/
39
+ .tox/
40
+ .nox/
41
+ .coverage
42
+ .coverage.*
43
+ .cache
44
+ nosetests.xml
45
+ coverage.xml
46
+ *.cover
47
+ *.py,cover
48
+ .hypothesis/
49
+ .pytest_cache/
50
+
51
+ # Translations
52
+ *.mo
53
+ *.pot
54
+
55
+ # Environments
56
+ .env
57
+ .venv
58
+ env/
59
+ venv/
60
+ ENV/
61
+ env.bak/
62
+ venv.bak/
63
+
64
+ # IDE
65
+ .idea/
66
+ .vscode/
67
+ *.swp
68
+ *.swo
69
+ *~
70
+
71
+ # mypy
72
+ .mypy_cache/
73
+ .dmypy.json
74
+ dmypy.json
75
+
76
+ # ruff
77
+ .ruff_cache/
78
+
79
+ # macOS
80
+ .DS_Store
81
+
82
+ # Project specific
83
+ *.log
84
+ .envrc
85
+
86
+ /.pypirc
@@ -0,0 +1,22 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Yevhenii
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.
22
+
@@ -0,0 +1,278 @@
1
+ Metadata-Version: 2.4
2
+ Name: intelliprint-py
3
+ Version: 0.1.0
4
+ Summary: Unofficial Python SDK for the Intelliprint API - Send physical mail as easily as sending email
5
+ Project-URL: Homepage, https://github.com/yevhenii/intelliprint-py
6
+ Project-URL: Documentation, https://docs.intelliprint.net
7
+ Project-URL: Repository, https://github.com/yevhenii/intelliprint-py
8
+ Project-URL: Issues, https://github.com/yevhenii/intelliprint-py/issues
9
+ Author-email: Yevhenii Dits <yevheniidits@gmail.com>
10
+ License-Expression: MIT
11
+ License-File: LICENSE
12
+ Keywords: api,intelliprint,letter,mail,physical-mail,postal,postcard,sdk
13
+ Classifier: Development Status :: 4 - Beta
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: License :: OSI Approved :: MIT License
16
+ Classifier: Operating System :: OS Independent
17
+ Classifier: Programming Language :: Python :: 3
18
+ Classifier: Programming Language :: Python :: 3.10
19
+ Classifier: Programming Language :: Python :: 3.11
20
+ Classifier: Programming Language :: Python :: 3.12
21
+ Classifier: Programming Language :: Python :: 3.13
22
+ Classifier: Topic :: Communications
23
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
24
+ Classifier: Typing :: Typed
25
+ Requires-Python: >=3.10
26
+ Requires-Dist: pydantic>=2.0.0
27
+ Requires-Dist: requests>=2.28.0
28
+ Provides-Extra: dev
29
+ Requires-Dist: mypy>=1.0.0; extra == 'dev'
30
+ Requires-Dist: pytest-cov>=4.0.0; extra == 'dev'
31
+ Requires-Dist: pytest>=7.0.0; extra == 'dev'
32
+ Requires-Dist: ruff>=0.1.0; extra == 'dev'
33
+ Requires-Dist: types-requests>=2.28.0; extra == 'dev'
34
+ Description-Content-Type: text/markdown
35
+
36
+ # intelliprint-py
37
+
38
+ Unofficial Python SDK for the [Intelliprint API](https://docs.intelliprint.net) - Send physical mail as easily as sending email.
39
+
40
+ [![PyPI version](https://badge.fury.io/py/intelliprint-py.svg)](https://badge.fury.io/py/intelliprint-py)
41
+ [![Python versions](https://img.shields.io/pypi/pyversions/intelliprint-py.svg)](https://pypi.org/project/intelliprint-py/)
42
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
43
+
44
+ ## Installation
45
+
46
+ ```bash
47
+ pip install intelliprint-py
48
+ ```
49
+
50
+ ## Quick Start
51
+
52
+ ```python
53
+ from intelliprint_py import (
54
+ IntelliprintClient,
55
+ IntelliprintAddress,
56
+ IntelliprintRecipient,
57
+ )
58
+
59
+ # Initialize the client
60
+ client = IntelliprintClient(api_key="your-api-key")
61
+ # Or use environment variable: INTELLIPRINT_API_KEY
62
+
63
+ # Create a simple print job
64
+ print_job = client.prints.create(
65
+ content="<h1>Hello World!</h1><p>This is my first letter.</p>",
66
+ testmode=True, # Required: explicitly set test mode
67
+ recipients=[
68
+ IntelliprintRecipient(
69
+ address=IntelliprintAddress(
70
+ name="John Doe",
71
+ line="123 Main Street, London",
72
+ postcode="SW1A 1AA",
73
+ )
74
+ )
75
+ ],
76
+ )
77
+
78
+ print(f"Created print job: {print_job['id']}")
79
+ ```
80
+
81
+ ## Using UserData
82
+
83
+ For more structured recipient management, use the `UserData` model:
84
+
85
+ ```python
86
+ from intelliprint_py import (
87
+ IntelliprintClient,
88
+ UserData,
89
+ UserAddress,
90
+ )
91
+
92
+ client = IntelliprintClient(api_key="your-api-key")
93
+
94
+ # Create user data with extra fields for template variables
95
+ user = UserData(
96
+ first_name="John",
97
+ last_name="Doe",
98
+ email="john@example.com",
99
+ user_id="customer_12345",
100
+ address=[
101
+ UserAddress(
102
+ building_number="123",
103
+ thoroughfare="Main Street",
104
+ post_town="London",
105
+ postcode="SW1A 1AA",
106
+ )
107
+ ],
108
+ extra={
109
+ "membership_level": "gold",
110
+ "account_balance": "£150.00",
111
+ },
112
+ )
113
+
114
+ # Create a print job using user data
115
+ print_job = client.prints.create(
116
+ content="""
117
+ <h1>Welcome, {first_name}!</h1>
118
+ <p>Your membership level: {membership_level}</p>
119
+ <p>Current balance: {account_balance}</p>
120
+ """,
121
+ testmode=True,
122
+ user_data=user,
123
+ )
124
+ ```
125
+
126
+ ## Services
127
+
128
+ ### Prints
129
+
130
+ Create and manage print jobs (letters and postcards):
131
+
132
+ ```python
133
+ # Create a print job
134
+ print_job = client.prints.create(
135
+ content="Hello World!",
136
+ testmode=True,
137
+ recipients=[...],
138
+ )
139
+
140
+ # Get a print job
141
+ print_job = client.prints.get("print_xxx")
142
+
143
+ # List print jobs
144
+ jobs = client.prints.list(limit=10, testmode=True)
145
+
146
+ # Update a print job
147
+ client.prints.update("print_xxx", reference="Updated reference")
148
+
149
+ # Confirm a print job for printing
150
+ client.prints.confirm("print_xxx")
151
+
152
+ # Delete/cancel a print job
153
+ client.prints.delete("print_xxx")
154
+ ```
155
+
156
+ ### Backgrounds
157
+
158
+ Manage letterhead backgrounds (no user data required):
159
+
160
+ ```python
161
+ # Create a background
162
+ with open("letterhead.pdf", "rb") as f:
163
+ background = client.backgrounds.create(
164
+ file_content=f.read(),
165
+ file_name="letterhead.pdf",
166
+ name="Company Letterhead",
167
+ )
168
+
169
+ # List backgrounds
170
+ backgrounds = client.backgrounds.list()
171
+
172
+ # Use a background in a print job
173
+ print_job = client.prints.create(
174
+ content="Hello!",
175
+ testmode=True,
176
+ recipients=[...],
177
+ background=BackgroundSettings(
178
+ first_page="bg_xxx",
179
+ other_pages="bg_yyy",
180
+ ),
181
+ )
182
+ ```
183
+
184
+ ### Mailing Lists
185
+
186
+ Manage mailing lists and recipients:
187
+
188
+ ```python
189
+ # Create a mailing list
190
+ mailing_list = client.mailing_lists.create(name="Newsletter Subscribers")
191
+
192
+ # Add a user to the mailing list
193
+ client.mailing_lists.add_user(
194
+ mailing_list_id="mal_xxx",
195
+ user_data=user,
196
+ additional_variables={"signup_date": "2024-01-15"},
197
+ )
198
+
199
+ # List recipients
200
+ recipients = client.mailing_lists.list_recipients("mal_xxx")
201
+
202
+ # Send to a mailing list
203
+ print_job = client.prints.create(
204
+ template="tmpl_xxx",
205
+ testmode=True,
206
+ mailing_list="mal_xxx",
207
+ )
208
+ ```
209
+
210
+ ## Configuration Options
211
+
212
+ ### Print Settings
213
+
214
+ ```python
215
+ from intelliprint_py import (
216
+ PrintingSettings,
217
+ PostageSettings,
218
+ PostageService,
219
+ EnvelopeSize,
220
+ )
221
+
222
+ print_job = client.prints.create(
223
+ content="Important document",
224
+ testmode=True,
225
+ recipients=[...],
226
+ printing=PrintingSettings(
227
+ double_sided="yes",
228
+ premium_quality=True,
229
+ black_and_white=False,
230
+ ),
231
+ postage=PostageSettings(
232
+ service=PostageService.UK_FIRST_CLASS,
233
+ ideal_envelope=EnvelopeSize.C4,
234
+ ),
235
+ )
236
+ ```
237
+
238
+ ## Error Handling
239
+
240
+ ```python
241
+ from intelliprint_py import IntelliprintClient, IntelliprintError
242
+
243
+ client = IntelliprintClient(api_key="your-api-key")
244
+
245
+ try:
246
+ print_job = client.prints.get("invalid_id")
247
+ except IntelliprintError as e:
248
+ print(f"Error: {e.message}")
249
+ print(f"Type: {e.error_type}")
250
+ print(f"Code: {e.error_code}")
251
+ ```
252
+
253
+ ## Development
254
+
255
+ ```bash
256
+ # Install development dependencies
257
+ pip install -e ".[dev]"
258
+
259
+ # Run tests
260
+ pytest
261
+
262
+ # Run linting
263
+ ruff check src/
264
+
265
+ # Run type checking
266
+ mypy src/
267
+ ```
268
+
269
+ ## License
270
+
271
+ MIT License - see [LICENSE](LICENSE) for details.
272
+
273
+ ## Links
274
+
275
+ - [Intelliprint API Documentation](https://docs.intelliprint.net)
276
+ - [Intelliprint Dashboard](https://account.intelliprint.net)
277
+ - [PyPI Package](https://pypi.org/project/intelliprint-py/)
278
+
@@ -0,0 +1,243 @@
1
+ # intelliprint-py
2
+
3
+ Unofficial Python SDK for the [Intelliprint API](https://docs.intelliprint.net) - Send physical mail as easily as sending email.
4
+
5
+ [![PyPI version](https://badge.fury.io/py/intelliprint-py.svg)](https://badge.fury.io/py/intelliprint-py)
6
+ [![Python versions](https://img.shields.io/pypi/pyversions/intelliprint-py.svg)](https://pypi.org/project/intelliprint-py/)
7
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
8
+
9
+ ## Installation
10
+
11
+ ```bash
12
+ pip install intelliprint-py
13
+ ```
14
+
15
+ ## Quick Start
16
+
17
+ ```python
18
+ from intelliprint_py import (
19
+ IntelliprintClient,
20
+ IntelliprintAddress,
21
+ IntelliprintRecipient,
22
+ )
23
+
24
+ # Initialize the client
25
+ client = IntelliprintClient(api_key="your-api-key")
26
+ # Or use environment variable: INTELLIPRINT_API_KEY
27
+
28
+ # Create a simple print job
29
+ print_job = client.prints.create(
30
+ content="<h1>Hello World!</h1><p>This is my first letter.</p>",
31
+ testmode=True, # Required: explicitly set test mode
32
+ recipients=[
33
+ IntelliprintRecipient(
34
+ address=IntelliprintAddress(
35
+ name="John Doe",
36
+ line="123 Main Street, London",
37
+ postcode="SW1A 1AA",
38
+ )
39
+ )
40
+ ],
41
+ )
42
+
43
+ print(f"Created print job: {print_job['id']}")
44
+ ```
45
+
46
+ ## Using UserData
47
+
48
+ For more structured recipient management, use the `UserData` model:
49
+
50
+ ```python
51
+ from intelliprint_py import (
52
+ IntelliprintClient,
53
+ UserData,
54
+ UserAddress,
55
+ )
56
+
57
+ client = IntelliprintClient(api_key="your-api-key")
58
+
59
+ # Create user data with extra fields for template variables
60
+ user = UserData(
61
+ first_name="John",
62
+ last_name="Doe",
63
+ email="john@example.com",
64
+ user_id="customer_12345",
65
+ address=[
66
+ UserAddress(
67
+ building_number="123",
68
+ thoroughfare="Main Street",
69
+ post_town="London",
70
+ postcode="SW1A 1AA",
71
+ )
72
+ ],
73
+ extra={
74
+ "membership_level": "gold",
75
+ "account_balance": "£150.00",
76
+ },
77
+ )
78
+
79
+ # Create a print job using user data
80
+ print_job = client.prints.create(
81
+ content="""
82
+ <h1>Welcome, {first_name}!</h1>
83
+ <p>Your membership level: {membership_level}</p>
84
+ <p>Current balance: {account_balance}</p>
85
+ """,
86
+ testmode=True,
87
+ user_data=user,
88
+ )
89
+ ```
90
+
91
+ ## Services
92
+
93
+ ### Prints
94
+
95
+ Create and manage print jobs (letters and postcards):
96
+
97
+ ```python
98
+ # Create a print job
99
+ print_job = client.prints.create(
100
+ content="Hello World!",
101
+ testmode=True,
102
+ recipients=[...],
103
+ )
104
+
105
+ # Get a print job
106
+ print_job = client.prints.get("print_xxx")
107
+
108
+ # List print jobs
109
+ jobs = client.prints.list(limit=10, testmode=True)
110
+
111
+ # Update a print job
112
+ client.prints.update("print_xxx", reference="Updated reference")
113
+
114
+ # Confirm a print job for printing
115
+ client.prints.confirm("print_xxx")
116
+
117
+ # Delete/cancel a print job
118
+ client.prints.delete("print_xxx")
119
+ ```
120
+
121
+ ### Backgrounds
122
+
123
+ Manage letterhead backgrounds (no user data required):
124
+
125
+ ```python
126
+ # Create a background
127
+ with open("letterhead.pdf", "rb") as f:
128
+ background = client.backgrounds.create(
129
+ file_content=f.read(),
130
+ file_name="letterhead.pdf",
131
+ name="Company Letterhead",
132
+ )
133
+
134
+ # List backgrounds
135
+ backgrounds = client.backgrounds.list()
136
+
137
+ # Use a background in a print job
138
+ print_job = client.prints.create(
139
+ content="Hello!",
140
+ testmode=True,
141
+ recipients=[...],
142
+ background=BackgroundSettings(
143
+ first_page="bg_xxx",
144
+ other_pages="bg_yyy",
145
+ ),
146
+ )
147
+ ```
148
+
149
+ ### Mailing Lists
150
+
151
+ Manage mailing lists and recipients:
152
+
153
+ ```python
154
+ # Create a mailing list
155
+ mailing_list = client.mailing_lists.create(name="Newsletter Subscribers")
156
+
157
+ # Add a user to the mailing list
158
+ client.mailing_lists.add_user(
159
+ mailing_list_id="mal_xxx",
160
+ user_data=user,
161
+ additional_variables={"signup_date": "2024-01-15"},
162
+ )
163
+
164
+ # List recipients
165
+ recipients = client.mailing_lists.list_recipients("mal_xxx")
166
+
167
+ # Send to a mailing list
168
+ print_job = client.prints.create(
169
+ template="tmpl_xxx",
170
+ testmode=True,
171
+ mailing_list="mal_xxx",
172
+ )
173
+ ```
174
+
175
+ ## Configuration Options
176
+
177
+ ### Print Settings
178
+
179
+ ```python
180
+ from intelliprint_py import (
181
+ PrintingSettings,
182
+ PostageSettings,
183
+ PostageService,
184
+ EnvelopeSize,
185
+ )
186
+
187
+ print_job = client.prints.create(
188
+ content="Important document",
189
+ testmode=True,
190
+ recipients=[...],
191
+ printing=PrintingSettings(
192
+ double_sided="yes",
193
+ premium_quality=True,
194
+ black_and_white=False,
195
+ ),
196
+ postage=PostageSettings(
197
+ service=PostageService.UK_FIRST_CLASS,
198
+ ideal_envelope=EnvelopeSize.C4,
199
+ ),
200
+ )
201
+ ```
202
+
203
+ ## Error Handling
204
+
205
+ ```python
206
+ from intelliprint_py import IntelliprintClient, IntelliprintError
207
+
208
+ client = IntelliprintClient(api_key="your-api-key")
209
+
210
+ try:
211
+ print_job = client.prints.get("invalid_id")
212
+ except IntelliprintError as e:
213
+ print(f"Error: {e.message}")
214
+ print(f"Type: {e.error_type}")
215
+ print(f"Code: {e.error_code}")
216
+ ```
217
+
218
+ ## Development
219
+
220
+ ```bash
221
+ # Install development dependencies
222
+ pip install -e ".[dev]"
223
+
224
+ # Run tests
225
+ pytest
226
+
227
+ # Run linting
228
+ ruff check src/
229
+
230
+ # Run type checking
231
+ mypy src/
232
+ ```
233
+
234
+ ## License
235
+
236
+ MIT License - see [LICENSE](LICENSE) for details.
237
+
238
+ ## Links
239
+
240
+ - [Intelliprint API Documentation](https://docs.intelliprint.net)
241
+ - [Intelliprint Dashboard](https://account.intelliprint.net)
242
+ - [PyPI Package](https://pypi.org/project/intelliprint-py/)
243
+