printnode-community 0.3.0__py3-none-any.whl
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.
- printnode_community/__init__.py +13 -0
- printnode_community/accounts.py +228 -0
- printnode_community/auth.py +224 -0
- printnode_community/computers.py +317 -0
- printnode_community/gateway.py +105 -0
- printnode_community/model.py +279 -0
- printnode_community/util.py +11 -0
- printnode_community-0.3.0.dist-info/METADATA +546 -0
- printnode_community-0.3.0.dist-info/RECORD +11 -0
- printnode_community-0.3.0.dist-info/WHEEL +4 -0
- printnode_community-0.3.0.dist-info/licenses/LICENSE +22 -0
|
@@ -0,0 +1,546 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: printnode_community
|
|
3
|
+
Version: 0.3.0
|
|
4
|
+
Summary: Community-maintained Python client for PrintNode's API
|
|
5
|
+
Project-URL: Homepage, https://github.com/cbusillo/printnode_community
|
|
6
|
+
Project-URL: Repository, https://github.com/cbusillo/printnode_community
|
|
7
|
+
Project-URL: Issues, https://github.com/cbusillo/printnode_community/issues
|
|
8
|
+
Project-URL: Upstream Repository, https://github.com/PrintNode/PrintNode-Python
|
|
9
|
+
Project-URL: PrintNode API Documentation, https://www.printnode.com/en/docs/api/curl
|
|
10
|
+
Author-email: PrintNode <support@printnode.com>
|
|
11
|
+
Maintainer: Community maintainers
|
|
12
|
+
License-Expression: MIT
|
|
13
|
+
License-File: LICENSE
|
|
14
|
+
Keywords: api,client,printing,printnode
|
|
15
|
+
Classifier: Development Status :: 4 - Beta
|
|
16
|
+
Classifier: Intended Audience :: Developers
|
|
17
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
18
|
+
Classifier: Programming Language :: Python :: 3
|
|
19
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
23
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
24
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
25
|
+
Classifier: Topic :: Internet :: WWW/HTTP
|
|
26
|
+
Classifier: Topic :: Office/Business
|
|
27
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
28
|
+
Requires-Python: >=3.10
|
|
29
|
+
Requires-Dist: future>=1.0.0
|
|
30
|
+
Requires-Dist: requests>=2.32.0
|
|
31
|
+
Description-Content-Type: text/markdown
|
|
32
|
+
|
|
33
|
+
## **PrintNode API Client Python Library**
|
|
34
|
+
|
|
35
|
+
> [!NOTE]
|
|
36
|
+
> This repository is a community-maintained fork of the PrintNode Python API client. It is not an official PrintNode release unless PrintNode explicitly confirms maintainership or transfer. The maintained project name is `printnode_community`.
|
|
37
|
+
|
|
38
|
+
This is a Python library to interact with PrintNode's remote printing API. This client allows you to access the API's functions for quick use in Python scripts.
|
|
39
|
+
|
|
40
|
+
### Requirements
|
|
41
|
+
|
|
42
|
+
* Python 3.10+
|
|
43
|
+
* requests
|
|
44
|
+
* future
|
|
45
|
+
|
|
46
|
+
### Installation
|
|
47
|
+
|
|
48
|
+
After the first maintained release is published, install the package with:
|
|
49
|
+
|
|
50
|
+
```sh
|
|
51
|
+
uv add printnode_community
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
or:
|
|
55
|
+
|
|
56
|
+
```sh
|
|
57
|
+
python -m pip install printnode_community
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Install from source with `uv`:
|
|
61
|
+
|
|
62
|
+
```sh
|
|
63
|
+
uv sync
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
For editable development installs, use:
|
|
67
|
+
|
|
68
|
+
```sh
|
|
69
|
+
uv pip install -e .
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
Until the first maintained release is published, prefer installing from a reviewed Git tag or branch rather than relying on an unpublished local build.
|
|
73
|
+
|
|
74
|
+
### Development
|
|
75
|
+
|
|
76
|
+
Install development dependencies and run tests with:
|
|
77
|
+
|
|
78
|
+
```sh
|
|
79
|
+
uv sync
|
|
80
|
+
uv run pytest
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
Build and validate package artifacts with:
|
|
84
|
+
|
|
85
|
+
```sh
|
|
86
|
+
uv build
|
|
87
|
+
uv run twine check dist/*
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### Releases
|
|
91
|
+
|
|
92
|
+
Release publishing is not enabled for general use yet. See [RELEASE.md](RELEASE.md) for the release process and TestPyPI/PyPI workflow requirements.
|
|
93
|
+
|
|
94
|
+
### Getting Started
|
|
95
|
+
|
|
96
|
+
The default constructor for the Library is a Gateway, which is constructed with at minimum of one key-word argument, that being an api-key.
|
|
97
|
+
|
|
98
|
+
```python
|
|
99
|
+
from printnode_community import Gateway
|
|
100
|
+
my_account_gateway = Gateway(apikey='my_api_key')
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
After creating a Gateway, you can access any requests as such:
|
|
104
|
+
|
|
105
|
+
```python
|
|
106
|
+
my_account_id = my_account_gateway.account.id
|
|
107
|
+
new_tag = my_account_gateway.ModifyTag("Likes","PrintNode")
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
### Initial Gateway Configuration
|
|
111
|
+
|
|
112
|
+
You can authenticate in 2 ways other than using an api-key:
|
|
113
|
+
```python
|
|
114
|
+
Gateway(email='email',password='password')
|
|
115
|
+
Gateway(clientkey='ckey')
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
The three below will authenticate with access to child accounts of a specific user:
|
|
119
|
+
|
|
120
|
+
```python
|
|
121
|
+
Gateway(apikey='api-key',child_email='c_email')
|
|
122
|
+
Gateway(apikey='api-key',child_ref='c_creator_ref')
|
|
123
|
+
Gateway(apikey='api-key',child_id='c_id')
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
### Gateway Methods
|
|
127
|
+
All of these will have the associated API doc next to them. Any of the argument types will be exactly the same as the attributes used in a normal request. Any "Objects" under type are represented as a `dict`, which will have the same representation as the JSON objects.
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
### Computers Library
|
|
131
|
+
This handles anything that is associated with a computer, such as Printers, PrintJobs, States (of PrintJobs) and Scales.
|
|
132
|
+
|
|
133
|
+
### Account lookup
|
|
134
|
+
https://www.printnode.com/docs/api/curl/#whoami
|
|
135
|
+
|
|
136
|
+
#### account(self)
|
|
137
|
+
Returns an Account object of the currently authenticated account.
|
|
138
|
+
```python
|
|
139
|
+
from printnode_community import Gateway
|
|
140
|
+
|
|
141
|
+
gateway=Gateway(url='https://api.printnode.com',apikey='secretAPIKey')
|
|
142
|
+
print(gateway.account.firstname)
|
|
143
|
+
|
|
144
|
+
'''
|
|
145
|
+
Results:
|
|
146
|
+
Mr
|
|
147
|
+
'''
|
|
148
|
+
```
|
|
149
|
+
### Computer lookup
|
|
150
|
+
https://www.printnode.com/docs/api/curl/#computers
|
|
151
|
+
|
|
152
|
+
#### computers(self, computer)
|
|
153
|
+
Given a set of computers, returns these computers. Given only one id, returns that computer.
|
|
154
|
+
|
|
155
|
+
```python
|
|
156
|
+
from printnode_community import Gateway
|
|
157
|
+
|
|
158
|
+
gateway=Gateway(url='https://api.printnode.com',apikey='secretAPIKey')
|
|
159
|
+
print(gateway.computers(computer=10027).name)
|
|
160
|
+
|
|
161
|
+
'''
|
|
162
|
+
Results:
|
|
163
|
+
5.2015-07-10 15:04:40.253763.TEST-COMPUTER
|
|
164
|
+
'''
|
|
165
|
+
```
|
|
166
|
+
### Printer lookup
|
|
167
|
+
https://www.printnode.com/docs/api/curl/#printers
|
|
168
|
+
|
|
169
|
+
#### printers(self, computer=None, printer=None)
|
|
170
|
+
There are four ways this can be run:
|
|
171
|
+
|
|
172
|
+
* *printer* & *computer* argument both None: Gives all printers attached to the account.
|
|
173
|
+
* *printer* str/int, *computer* None: Gives a printer found from either an id or the name of a printer, taken from all possible printers.
|
|
174
|
+
* *printer* None, *computer* int: Gives all printers attached to the computer given by an id.
|
|
175
|
+
* *printer* str/int, *computer* int: Gives a printer found from either an id or the name of a printer, taken only from printers attached to the computer specified by the computer's id.
|
|
176
|
+
|
|
177
|
+
```python
|
|
178
|
+
from printnode_community import Gateway
|
|
179
|
+
|
|
180
|
+
gateway=Gateway(url='https://api.printnode.com',apikey='secretAPIKey')
|
|
181
|
+
print(gateway.printers(printer=50120).name)
|
|
182
|
+
for printer in gateway.printers(computer=10027):
|
|
183
|
+
print(printer.name)
|
|
184
|
+
|
|
185
|
+
'''
|
|
186
|
+
Results:
|
|
187
|
+
10027.3.TEST-PRINTER
|
|
188
|
+
10027.1.TEST-PRINTER
|
|
189
|
+
10027.2.TEST-PRINTER
|
|
190
|
+
10027.3.TEST-PRINTER
|
|
191
|
+
10027.4.TEST-PRINTER
|
|
192
|
+
10027.5.TEST-PRINTER
|
|
193
|
+
'''
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
### PrintJob lookup
|
|
197
|
+
https://www.printnode.com/docs/api/curl/#printjob-viewing
|
|
198
|
+
|
|
199
|
+
#### printjobs(self, computer=None, printer=None, printjob=None
|
|
200
|
+
There are five ways this can be run:
|
|
201
|
+
|
|
202
|
+
* No arguments : Returns all printjobs associated with the account.
|
|
203
|
+
* *computer* int : Returns all printjobs relative to printers associated with the computer specified by the argument *computer*.
|
|
204
|
+
* *printer* int : Returns all printjobs relative to the printer specificed by the argument *printer*.
|
|
205
|
+
* *computer* int, *printer* int : Returns all printjobs relative to the printer specified by the argument *printer* from printers with access to *computer*.
|
|
206
|
+
* *printjob* int : Returns specific printjob.
|
|
207
|
+
|
|
208
|
+
```python
|
|
209
|
+
from printnode_community import Gateway
|
|
210
|
+
|
|
211
|
+
gateway=Gateway(url='https://api.printnode.com',apikey='secretAPIKey')
|
|
212
|
+
printjob_id = gateway.printjobs(computer=10027)[0].id
|
|
213
|
+
print(gateway.printjobs(printer=50120)[0].id)
|
|
214
|
+
print(gateway.printjobs(printjob=printjob_id))
|
|
215
|
+
|
|
216
|
+
'''
|
|
217
|
+
Results:
|
|
218
|
+
251137
|
|
219
|
+
PrintJob(id=251127, printer=Printer(id=50118, computer=Computer(id=10027, name='5.2015-07-10 15:04:40.253763.TEST-COMPUTER', inet=None, inet6=None, hostname=None, version=None, create_timestamp='2015-07-10T15:04:40.253Z', state='created'), name='10027.1.TEST-PRINTER', description='description', capabilities={'capability_1': 'one', 'capability_2': 'two'}, default=True, create_timestamp='2015-07-10T15:04:40.253Z', state=None), title='50118.1.TEST-PRINTJOB', content_type='pdf_uri', source='API test endpoint', expire_at=None, create_timestamp='2015-07-10T15:04:40.253Z', state='new')
|
|
220
|
+
'''
|
|
221
|
+
```
|
|
222
|
+
### PrintJob creation
|
|
223
|
+
https://www.printnode.com/docs/api/curl/#printjob-creating
|
|
224
|
+
|
|
225
|
+
#### PrintJob(self, computer=None, printer=None, job_type='pdf', title='PrintJob',options=None,authentication=None,uri=None,base64=None,binary=None)
|
|
226
|
+
Only one of uri, base64 and binary can be chosen.
|
|
227
|
+
|
|
228
|
+
```python
|
|
229
|
+
from printnode_community import Gateway
|
|
230
|
+
|
|
231
|
+
gateway=Gateway(url='https://api.printnode.com',apikey='secretAPIKey')
|
|
232
|
+
print(gateway.PrintJob(printer=50120,options={"copies":2},uri="a.pdf"))
|
|
233
|
+
|
|
234
|
+
'''
|
|
235
|
+
Results:
|
|
236
|
+
PrintJob(id=251153, printer=Printer(id=50120, computer=Computer(id=10027, name='5.2015-07-10 15:04:40.253763.TEST-COMPUTER', inet=None, inet6=None, hostname=None, version=None, create_timestamp='2015-07-10T15:04:40.253Z', state='created'), name='10027.3.TEST-PRINTER', description='description', capabilities={'capability_1': 'one', 'capability_2': 'two'}, default=False, create_timestamp='2015-07-10T15:04:40.253Z', state=None), title='PrintJob', content_type='pdf_uri', source='PythonApiClient', expire_at=None, create_timestamp='2015-07-10T15:05:27.087Z', state='new')
|
|
237
|
+
'''
|
|
238
|
+
```
|
|
239
|
+
### State lookup
|
|
240
|
+
|
|
241
|
+
https://www.printnode.com/docs/api/curl/#printjob-states
|
|
242
|
+
|
|
243
|
+
#### states(self, printjob_set)
|
|
244
|
+
Given a set of printjobs as a string (check https://www.printnode.com/docs/api/curl/#parameters for examples), returns a list of object type State. As each PrintJob can have many states, `states()` is a list of PrintJobs that each have a list of States.
|
|
245
|
+
|
|
246
|
+
```python
|
|
247
|
+
from printnode_community import Gateway
|
|
248
|
+
|
|
249
|
+
gateway=Gateway(url='https://api.printnode.com',apikey='secretAPIKey')
|
|
250
|
+
printjob_id = gateway.printjobs(computer=10027)[0].id
|
|
251
|
+
print(gateway.states(printjob_id)[0][0].state)
|
|
252
|
+
|
|
253
|
+
'''
|
|
254
|
+
Results:
|
|
255
|
+
new
|
|
256
|
+
'''
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
### Accounts Library
|
|
260
|
+
This handles anything to do with accounts, such as Account creation, deletion and modificaiton, api-key handling, tag handling and Client handling.
|
|
261
|
+
|
|
262
|
+
### Tag lookup
|
|
263
|
+
https://www.printnode.com/docs/api/curl/#account-tagging
|
|
264
|
+
|
|
265
|
+
#### tag(self, tagname)
|
|
266
|
+
Given a *tagname*, returns the value of that tag.
|
|
267
|
+
|
|
268
|
+
```python
|
|
269
|
+
from printnode_community import Gateway
|
|
270
|
+
|
|
271
|
+
gateway=Gateway(url='https://api.printnode.com',apikey='secretAPIKey')
|
|
272
|
+
print(gateway.tag("Likes"))
|
|
273
|
+
|
|
274
|
+
'''
|
|
275
|
+
Results:
|
|
276
|
+
Everything!
|
|
277
|
+
'''
|
|
278
|
+
```
|
|
279
|
+
### Tag modification
|
|
280
|
+
#### ModifyTag(self, tagname, tagvalue)
|
|
281
|
+
Given a *tagname* and *tagvalue*, either creates a tag with specifed value if *tagname* doesn't exist, otherwise changes the value.
|
|
282
|
+
|
|
283
|
+
```python
|
|
284
|
+
from printnode_community import Gateway
|
|
285
|
+
|
|
286
|
+
gateway=Gateway(url='https://api.printnode.com',apikey='secretAPIKey')
|
|
287
|
+
gateway.ModifyTag("Likes","PrintNode")
|
|
288
|
+
print(gateway.tag("Likes"))
|
|
289
|
+
|
|
290
|
+
'''
|
|
291
|
+
Results:
|
|
292
|
+
PrintNode
|
|
293
|
+
'''
|
|
294
|
+
```
|
|
295
|
+
|
|
296
|
+
### Tag deletion
|
|
297
|
+
#### DeleteTag(self, tagname)
|
|
298
|
+
Given a *tagname*, deletes that tag. Returns True on successful deletion.
|
|
299
|
+
|
|
300
|
+
```python
|
|
301
|
+
from printnode_community import Gateway
|
|
302
|
+
|
|
303
|
+
gateway=Gateway(url='https://api.printnode.com',apikey='secretAPIKey')
|
|
304
|
+
gateway.ModifyTag("Likes","PrintNode")
|
|
305
|
+
gateway.DeleteTag("Likes")
|
|
306
|
+
print(gateway.account.tags)
|
|
307
|
+
|
|
308
|
+
'''
|
|
309
|
+
Results:
|
|
310
|
+
[]
|
|
311
|
+
'''
|
|
312
|
+
```
|
|
313
|
+
|
|
314
|
+
### Account creation
|
|
315
|
+
https://www.printnode.com/docs/api/curl/#account-creation
|
|
316
|
+
|
|
317
|
+
#### CreateAccount(self, firstname, lastname, email, password, creator_ref=None, api_keys=None, tags=None)
|
|
318
|
+
Creates an account with the specified values. The last three are optional.
|
|
319
|
+
|
|
320
|
+
```python
|
|
321
|
+
from printnode_community import Gateway
|
|
322
|
+
|
|
323
|
+
gateway=Gateway(url='https://api.printnode.com',apikey='secretAPIKey')
|
|
324
|
+
new_account = gateway.CreateAccount(
|
|
325
|
+
firstname="A",
|
|
326
|
+
lastname="Person",
|
|
327
|
+
password="password",
|
|
328
|
+
email="aperson@emailprovider.com",
|
|
329
|
+
tags={"Likes":"Something"}
|
|
330
|
+
)
|
|
331
|
+
new_account_gateway = Gateway(url='https://api.printnode.com',apikey='secretAPIKey',child_id=new_account["Account"]["id"])
|
|
332
|
+
print(new_account_gateway.account.firstname)
|
|
333
|
+
new_account_gateway.DeleteAccount()
|
|
334
|
+
|
|
335
|
+
'''
|
|
336
|
+
Results:
|
|
337
|
+
A
|
|
338
|
+
'''
|
|
339
|
+
```
|
|
340
|
+
|
|
341
|
+
### Account deletion
|
|
342
|
+
https://www.printnode.com/docs/api/curl/#account-deletion
|
|
343
|
+
|
|
344
|
+
#### DeleteAccount(self)
|
|
345
|
+
Deletes the child account that is currently authenticated. Accounts can only be deleted if authenticated by a parent account's api-key and a reference to the child account being deleted (e.g the child account's id)
|
|
346
|
+
```python
|
|
347
|
+
from printnode_community import Gateway
|
|
348
|
+
|
|
349
|
+
gateway=Gateway(url='https://api.printnode.com',apikey='secretAPIKey')
|
|
350
|
+
new_account = gateway.CreateAccount(
|
|
351
|
+
firstname="A",
|
|
352
|
+
lastname="Person",
|
|
353
|
+
password="password",
|
|
354
|
+
email="aperson@emailprovider.com",
|
|
355
|
+
tags={"Likes":"Something"}
|
|
356
|
+
)
|
|
357
|
+
new_account_gateway = Gateway(url='https://api.printnode.com',apikey='secretAPIKey',child_id=new_account["Account"]["id"])
|
|
358
|
+
new_account_gateway.DeleteAccount()
|
|
359
|
+
print(new_account["Account"]["id"] in gateway.account.child_accounts)
|
|
360
|
+
|
|
361
|
+
'''
|
|
362
|
+
Results:
|
|
363
|
+
False
|
|
364
|
+
'''
|
|
365
|
+
```
|
|
366
|
+
|
|
367
|
+
### Account modification
|
|
368
|
+
https://www.printnode.com/docs/api/curl/#account-modification
|
|
369
|
+
|
|
370
|
+
#### ModifyAccount(self, firstname=None, lastname=None, password=None, email=None, creator_ref=None)
|
|
371
|
+
Given one or more arguments, changes the account details specified by the arguments.
|
|
372
|
+
|
|
373
|
+
```python
|
|
374
|
+
from printnode_community import Gateway
|
|
375
|
+
|
|
376
|
+
gateway=Gateway(url='https://api.printnode.com',apikey='secretAPIKey')
|
|
377
|
+
new_account = gateway.CreateAccount(
|
|
378
|
+
firstname="A",
|
|
379
|
+
lastname="Person",
|
|
380
|
+
password="password",
|
|
381
|
+
email="aperson@emailprovider.com",
|
|
382
|
+
tags={"Likes":"Something"}
|
|
383
|
+
)
|
|
384
|
+
new_account_gateway = Gateway(url='https://api.printnode.com',apikey='secretAPIKey',child_id=new_account["Account"]["id"])
|
|
385
|
+
new_account_gateway.ModifyAccount(firstname="B")
|
|
386
|
+
print(new_account_gateway.account.firstname)
|
|
387
|
+
new_account_gateway.DeleteAccount()
|
|
388
|
+
|
|
389
|
+
'''
|
|
390
|
+
Results:
|
|
391
|
+
B
|
|
392
|
+
'''
|
|
393
|
+
```
|
|
394
|
+
### Api-key lookup
|
|
395
|
+
https://www.printnode.com/docs/api/curl/#account-apikeys
|
|
396
|
+
|
|
397
|
+
#### apikey(self, api_key)
|
|
398
|
+
Returns value of api-key specified by the argument.
|
|
399
|
+
```python
|
|
400
|
+
from printnode_community import Gateway
|
|
401
|
+
|
|
402
|
+
gateway=Gateway(url='https://api.printnode.com',apikey='secretAPIKey')
|
|
403
|
+
new_account = gateway.CreateAccount(
|
|
404
|
+
firstname="A",
|
|
405
|
+
lastname="Person",
|
|
406
|
+
password="password",
|
|
407
|
+
email="aperson@emailprovider.com",
|
|
408
|
+
tags={"Likes":"Something"},
|
|
409
|
+
api_keys=["Production"]
|
|
410
|
+
)
|
|
411
|
+
new_account_gateway = Gateway(url='https://api.printnode.com',apikey='secretAPIKey',child_id=new_account["Account"]["id"])
|
|
412
|
+
print(new_account_gateway.api_key("Production"))
|
|
413
|
+
new_account_gateway.DeleteAccount()
|
|
414
|
+
|
|
415
|
+
'''
|
|
416
|
+
Results:
|
|
417
|
+
5a272ed7406d351be86f25be388810dc83b8f52d
|
|
418
|
+
'''
|
|
419
|
+
```
|
|
420
|
+
### API Key Creation
|
|
421
|
+
#### CreateApikey(self, api_key)
|
|
422
|
+
Creates an api-key with the api-key's reference given by the argument.
|
|
423
|
+
|
|
424
|
+
```python
|
|
425
|
+
from printnode_community import Gateway
|
|
426
|
+
|
|
427
|
+
gateway = Gateway(url='https://api.printnode.com',apikey='secretAPIKey')
|
|
428
|
+
new_account = gateway.CreateAccount(
|
|
429
|
+
firstname="A",
|
|
430
|
+
lastname="Person",
|
|
431
|
+
password="password",
|
|
432
|
+
email="aperson@emailprovider.com",
|
|
433
|
+
tags={"Likes":"Something"},
|
|
434
|
+
api_keys=["Production"]
|
|
435
|
+
)
|
|
436
|
+
new_account_gateway = Gateway(url='https://api.printnode.com',apikey='secretAPIKey',child_id=new_account["Account"]["id"])
|
|
437
|
+
new_account_gateway.CreateApiKey("Development")
|
|
438
|
+
print(new_account_gateway.account.api_keys)
|
|
439
|
+
new_account_gateway.DeleteAccount()
|
|
440
|
+
|
|
441
|
+
'''
|
|
442
|
+
Results:
|
|
443
|
+
{'Development': '123SecretAPIKey', 'Production': '456SecretAPIKey'}
|
|
444
|
+
'''
|
|
445
|
+
```
|
|
446
|
+
### API Key Deletion
|
|
447
|
+
#### DeleteApikey(self, api_key)
|
|
448
|
+
Deletes api-key specified by the argument.
|
|
449
|
+
|
|
450
|
+
```python
|
|
451
|
+
from printnode_community import Gateway
|
|
452
|
+
|
|
453
|
+
gateway=Gateway(url='https://api.printnode.com',apikey='secretAPIKey')
|
|
454
|
+
new_account = gateway.CreateAccount(
|
|
455
|
+
firstname="A",
|
|
456
|
+
lastname="Person",
|
|
457
|
+
password="password",
|
|
458
|
+
email="aperson@emailprovider.com",
|
|
459
|
+
tags={"Likes":"Something"},
|
|
460
|
+
api_keys=["Production"]
|
|
461
|
+
)
|
|
462
|
+
new_account_gateway = Gateway(url='https://api.printnode.com',apikey='secretAPIKey',child_id=new_account["Account"]["id"])
|
|
463
|
+
new_account_gateway.DeleteApiKey("Production")
|
|
464
|
+
print(new_account_gateway.account.api_keys)
|
|
465
|
+
new_account_gateway.DeleteAccount()
|
|
466
|
+
|
|
467
|
+
'''
|
|
468
|
+
Results:
|
|
469
|
+
[]
|
|
470
|
+
'''
|
|
471
|
+
```
|
|
472
|
+
|
|
473
|
+
### Client Key creation
|
|
474
|
+
https://www.printnode.com/docs/api/curl/#account-delegated-auth
|
|
475
|
+
|
|
476
|
+
#### clientkey(self, uuid, edition, version)
|
|
477
|
+
Generates a clientkey for the account.
|
|
478
|
+
|
|
479
|
+
```python
|
|
480
|
+
from printnode_community import Gateway
|
|
481
|
+
|
|
482
|
+
gateway=Gateway(url='https://api.printnode.com',apikey='secretAPIKey')
|
|
483
|
+
new_account = gateway.CreateAccount(
|
|
484
|
+
firstname="A",
|
|
485
|
+
lastname="Person",
|
|
486
|
+
password="password",
|
|
487
|
+
email="aperson@emailprovider.com",
|
|
488
|
+
tags={"Likes":"Something"},
|
|
489
|
+
api_keys=["Production"]
|
|
490
|
+
)
|
|
491
|
+
new_account_gateway = Gateway(url='https://api.printnode.com',apikey='secretAPIKey',child_id=new_account["Account"]["id"])
|
|
492
|
+
new_clientkey = new_account_gateway.clientkey(
|
|
493
|
+
uuid="0a756864-602e-428f-a90b-842dee47f57e",
|
|
494
|
+
edition="printnode",
|
|
495
|
+
version="4.7.2")
|
|
496
|
+
print(new_clientkey)
|
|
497
|
+
new_account_gateway.DeleteAccount()
|
|
498
|
+
|
|
499
|
+
'''
|
|
500
|
+
Results:
|
|
501
|
+
ck-nwa2SSvSGl1YR5zrHDVVgfdpJ8JLfVCvwaCWj8dQXmZW
|
|
502
|
+
'''
|
|
503
|
+
```
|
|
504
|
+
### Download client lookup
|
|
505
|
+
https://www.printnode.com/docs/api/curl/#account-download-management
|
|
506
|
+
|
|
507
|
+
#### clients(self, client_ids = None, os = None)
|
|
508
|
+
This has three different outcomes:
|
|
509
|
+
|
|
510
|
+
* *os* and *client_ids* both None: Returns all clients available for the current account.
|
|
511
|
+
* *os* str and *client_ids* None: Returns the most recent version for given OS ("windows" or "osx" only)
|
|
512
|
+
* *os* None and *client_ids* str: Given a set of ids (e.g "11-15"), return all clients in that set.
|
|
513
|
+
|
|
514
|
+
Having both set will default to showing the most recent version for the os argument.
|
|
515
|
+
|
|
516
|
+
```python
|
|
517
|
+
from printnode_community import Gateway
|
|
518
|
+
|
|
519
|
+
gateway=Gateway(url='https://api.printnode.com',apikey='secretAPIKey')
|
|
520
|
+
for client in gateway.clients(client_ids="11-12"):
|
|
521
|
+
print(client.id)
|
|
522
|
+
print(gateway.clients(os="windows").os)
|
|
523
|
+
|
|
524
|
+
'''
|
|
525
|
+
Results:
|
|
526
|
+
12
|
|
527
|
+
11
|
|
528
|
+
windows
|
|
529
|
+
'''
|
|
530
|
+
```
|
|
531
|
+
|
|
532
|
+
### Download client controlling
|
|
533
|
+
#### ModifyClientDownloads(self, client_id, enabled)
|
|
534
|
+
Given a set of ids and either True or False, sets whether the clients are enabled or not. Returns a list of modified clients.
|
|
535
|
+
```python
|
|
536
|
+
from printnode_community import Gateway
|
|
537
|
+
|
|
538
|
+
gateway=Gateway(url='https://api.printnode.com',apikey='secretAPIKey')
|
|
539
|
+
gateway.ModifyClientDownloads(11,False)
|
|
540
|
+
print(gateway.clients(client_ids=11)[0].enabled)
|
|
541
|
+
|
|
542
|
+
'''
|
|
543
|
+
Results:
|
|
544
|
+
False
|
|
545
|
+
'''
|
|
546
|
+
```
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
printnode_community/__init__.py,sha256=NtXYNUhp_7kj1E9cNCOV92nkoxBu37ZWaF-qJ7d4ksk,253
|
|
2
|
+
printnode_community/accounts.py,sha256=Yb8KDoLIlrQ7lAexyF5u3eqNID3Sj9cTC9KSGBYSY3Q,6716
|
|
3
|
+
printnode_community/auth.py,sha256=1xAPIE-bkBBP0vX0-JjLNc3rBluZdFYYPQ1QVrWvH6c,7335
|
|
4
|
+
printnode_community/computers.py,sha256=1fQN7RMjF8zeZaM4tZgzGhKbLiQ58k4_JpgyOFXX-8k,12126
|
|
5
|
+
printnode_community/gateway.py,sha256=g9DMRuddQmrVbtkXoV_HUYmeHee7XenuWZwywTX1KiY,2764
|
|
6
|
+
printnode_community/model.py,sha256=WCv7ax5X3IXFCmapFWJ3QIQ3j8xJnA_wKatHFC5u4C0,6220
|
|
7
|
+
printnode_community/util.py,sha256=ES2bZIx8k0Efysfx86EcZaynoi0F21D_AbdDTgpi7Uc,335
|
|
8
|
+
printnode_community-0.3.0.dist-info/METADATA,sha256=NNLeoDlhyAzBgXN-C-8U_2ywLtAxMp-6udL4OiqFhTA,17424
|
|
9
|
+
printnode_community-0.3.0.dist-info/WHEEL,sha256=QccIxa26bgl1E6uMy58deGWi-0aeIkkangHcxk2kWfw,87
|
|
10
|
+
printnode_community-0.3.0.dist-info/licenses/LICENSE,sha256=s6jS8JeWAstJBMUPWijqvsZk20acsMxRGYlk-d3jpk8,1081
|
|
11
|
+
printnode_community-0.3.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2015 PrintNode Ltd
|
|
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
|
+
|