summaryrefslogtreecommitdiff
path: root/python-pydispix.spec
blob: b5fb202d35f10590d0aa0082518d2bf3923185e4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
%global _empty_manifest_terminate_build 0
Name:		python-pydispix
Version:	1.2.1
Release:	1
Summary:	API wrapper for python-discord's pixels.
License:	MIT
URL:		https://github.com/ItsDrike/pydispix
Source0:	https://mirrors.nju.edu.cn/pypi/web/packages/bf/ab/379756904f785bc084da24d3cf4b789f482e6f21a07d42423533c1cb6bd8/pydispix-1.2.1.tar.gz
BuildArch:	noarch

Requires:	python3-requests
Requires:	python3-pillow
Requires:	python3-matplotlib
Requires:	python3-colorama

%description
# PyDisPix

[![made-with-python](https://img.shields.io/badge/Made%20with-Python%203.8+-ffe900.svg?longCache=true&style=flat-square&colorB=00a1ff&logo=python&logoColor=88889e)](https://www.python.org/)
[![MIT](https://img.shields.io/badge/Licensed%20under-MIT-red.svg?style=flat-square)](./LICENSE)
[![Validation](https://github.com/ItsDrike/pydispix/actions/workflows/validation.yml/badge.svg)](https://github.com/ItsDrike/pydispix/actions/workflows/validation.yml)

A simple wrapper around [Python Discord Pixels](https://pixels.pythondiscord.com).
Check it out on [PyPI](https://pypi.org/project/pydispix/).

## Examples

### Main usage

```py
import pydispix

# Create a client with your token.
client = pydispix.Client('my-auth-token')

# Fetch a specific pixel.
print(client.get_pixel(4, 10))

# Draw a pixel.
client.put_pixel(50, 10, 'cyan')
client.put_pixel(1, 5, pydispix.Color.BLURPLE)
client.put_pixel(100, 4, '93FF00')
client.put_pixel(44, 0, 0xFF0000)
client.put_pixel(8, 54, (255, 255, 255))
```

### Canvas

We can also work with the whole pixels canvas

```py
# Fetch the canvas
canvas = client.get_canvas()

# Show the canvas using matplotlib, this will include coordinates
canvas.show()

# Save the canvas to a file
canvas.save('canvas.png')

# And access pixels from it.
print(canvas[4, 10])
```

### Draw image from png

Load an image:

```py
from PIL import Image

im = Image.open('pretty.png')
ad = pydispix.AutoDrawer.load_image(client, (5, 40), im, scale=0.1)
ad.draw()
```

Auto-draw will avoid colouring already correct pixels, for efficiency.

You can also run this continually with `guard=True` which makes sure that after your image
is drawn, this keeps running to check if it haven't been tampered with, and fixes all non-matching
pixels.

```py
ad.draw(guard=True, guard_delay=2)
```

`guard_delay` is the delay between each full iteration of all pixels. We need to wait since
looping without any changes is almost instant in python, and we don't want to put cpu through that
stress for no reason

### Draw multiple images

You can also draw multiple images one by one

```py
from PIL import Image
from pydispix import Client, AutoDrawer

client = Client("pixels_api_token")

positions = [(52, 14), (120, 54)]
images = [Image("img1.png"), Image("img2.png")]
scales = [0.5, 1]

ad = AutoDrawer.load_images(client, positions, images, scales, one_by_one=True)
ad.draw()
```

This will proceed to start drawing the images in order they were passed. You could also
set `one_by_one` to `False`, which would cause the images to instead be drawn by pixel
from each, i.e. 1st pixel from img1, 1st pixel from img2, 2nd from img1, 2nd from img2, ...

### Collaborate on image drawing

You can share the load of drawing a single image between multiple joined clients.
This will mean each client will only ever work on it's part of given image, both when guarding and drawing it.

```py
from PIL import Image
from pydispix import DistributedClient, DistributedAutoDrawer

# First machine
multi_client = DistributedClient('pixels_api_key', total_tasks=2 ,controlled_tasks=[0])
# Second machine
#multi_client = MultiClient('pixels_api_key2', total_tasks=2 ,controlled_tasks=[1])

image = Image.open('my_img.png')
auto_drawer = DistributedAutoDrawer.load_image(multi_client, (2, 10), image, scale=0.8)
auto_drawer.draw(guard=True)
```

`total_tasks` is the number of clients you will have in total, i.e. the number of workers
for shared tasks. It's how many groups will the shared pixels be split into.

`controlled_tasks` are the groups controlled by this `MultiClient` instance. This is usually
only 1 task, but you can specify multiple tasks and split the code further.

### Churches

Churches are groups of people collaborating on some image, or set of images on the canvas.
It's basically a big botnet of people. Most popular church is currently the
[Church Of Rick](https://pixel-tasks.scoder12.repl.co/). Churches provide it's members with
tasks to fill certain pixels, and the members finish those tasks and report it back to the church.
This is how you run a single task like this with Church of Rick:

```py
from pydispix.churches import RickChurchClient

client = RickChurchClient(pixels_api_token, rick_church_api_token)
client.run_task(show_progress=True)
```

Church of SQLite is also supported, and they don't require an API key, it is free for everyone:

```py
from pydispix.churches import SQLiteChurchClient

client = SQLiteChurchClient(pixels_api_token)
client.run_task()
```

### Continually running church tasks

If you wish to keep running church tasks continually in a loop, make sure to use `client.run_tasks()`,
avoid `client.run_task()` since it doesn't handle any errors specific to the used church,
`client.run_tasks()` will handle these errors cleanly and log the problems if some ocurred.

Note: `client.run_tasks()` only handles known exceptions, there might still be some exceptions that a church
could raise which aren't handled. If you manage to find one make sure to file an issue about it.

Example of safe continual script to keep running church tasks on your machine:

```py
import pickle
import time
from pydispix.churches import RickChurchClient

client = RickChurchClient(pixels_api_token, rick_church_api_token)

exception_amt = 0
while True:
    try:
        client.run_tasks(show_progress=True)
    except Exception as exc:
        print(f"Exception ocurred: {exc} (#{exception_amt})")
        with open(f"exception{exception_amt}.pickle", "wb") as f:
            pickle.dump(exc, f)
        exception_amt += 1
        time.sleep(5)
```

There is still exception handling here, but it shouldn't capture any, it's only here since you'll
likely not be there to monitor the process all the time, so even in the rare case that something
were to occur, the program will keep running and the exception will stored with pickle.

If you see that this happened (if you find `exceptionX.pickle` files in your working directory),
load the pickled exception and examine what exactly happened. Upload the traceback with the issue.

```py
import pickle

with open("exception0.pickle", "rb") as f:
  exc = pickle.load(f)

raise exc
```

**Important: do not upload the pickle file anywhere, it contains the request, which includes your
API keys, uploading the pickled file would inevitable lead to leaked API key.**

### Other churches

You can also implement your own church according to it's specific API requirements, if you're
interested in doing this, check the [church.py](pydispix/church.py) and how the specific churches
are implemented using it: [churches.py](pydispix/churches.py).

If you do end up implementing it, feel free to also open a pull request and add it, if the church
is popular enough, you have a good chance of it being added to official `pydispix`.

### Progress bars

Every request that has rate limits can now display a progress bar while it's sleeping on cooldown:

```py
pixel = client.get_pixel(0, 0, show_progress=True)
canvas = client.get_canvas(show_progress=True)
client.put_pixel(52, 10, "FFFFFF", show_progress=True)
```

https://user-images.githubusercontent.com/20902250/119607092-418e4200-bde3-11eb-9ac5-4e455ffd47c2.mp4

### Logging

To see logs, you can set the `DEBUG` environment variable, which changes the loglevel from `logging.INFO` to `logging.DEBUG`
You can also do this manually by executing:

```py
import logging

logger = logging.getLogger("pydispix")
logger.setLevel(logging.DEBUG)
```


%package -n python3-pydispix
Summary:	API wrapper for python-discord's pixels.
Provides:	python-pydispix
BuildRequires:	python3-devel
BuildRequires:	python3-setuptools
BuildRequires:	python3-pip
%description -n python3-pydispix
# PyDisPix

[![made-with-python](https://img.shields.io/badge/Made%20with-Python%203.8+-ffe900.svg?longCache=true&style=flat-square&colorB=00a1ff&logo=python&logoColor=88889e)](https://www.python.org/)
[![MIT](https://img.shields.io/badge/Licensed%20under-MIT-red.svg?style=flat-square)](./LICENSE)
[![Validation](https://github.com/ItsDrike/pydispix/actions/workflows/validation.yml/badge.svg)](https://github.com/ItsDrike/pydispix/actions/workflows/validation.yml)

A simple wrapper around [Python Discord Pixels](https://pixels.pythondiscord.com).
Check it out on [PyPI](https://pypi.org/project/pydispix/).

## Examples

### Main usage

```py
import pydispix

# Create a client with your token.
client = pydispix.Client('my-auth-token')

# Fetch a specific pixel.
print(client.get_pixel(4, 10))

# Draw a pixel.
client.put_pixel(50, 10, 'cyan')
client.put_pixel(1, 5, pydispix.Color.BLURPLE)
client.put_pixel(100, 4, '93FF00')
client.put_pixel(44, 0, 0xFF0000)
client.put_pixel(8, 54, (255, 255, 255))
```

### Canvas

We can also work with the whole pixels canvas

```py
# Fetch the canvas
canvas = client.get_canvas()

# Show the canvas using matplotlib, this will include coordinates
canvas.show()

# Save the canvas to a file
canvas.save('canvas.png')

# And access pixels from it.
print(canvas[4, 10])
```

### Draw image from png

Load an image:

```py
from PIL import Image

im = Image.open('pretty.png')
ad = pydispix.AutoDrawer.load_image(client, (5, 40), im, scale=0.1)
ad.draw()
```

Auto-draw will avoid colouring already correct pixels, for efficiency.

You can also run this continually with `guard=True` which makes sure that after your image
is drawn, this keeps running to check if it haven't been tampered with, and fixes all non-matching
pixels.

```py
ad.draw(guard=True, guard_delay=2)
```

`guard_delay` is the delay between each full iteration of all pixels. We need to wait since
looping without any changes is almost instant in python, and we don't want to put cpu through that
stress for no reason

### Draw multiple images

You can also draw multiple images one by one

```py
from PIL import Image
from pydispix import Client, AutoDrawer

client = Client("pixels_api_token")

positions = [(52, 14), (120, 54)]
images = [Image("img1.png"), Image("img2.png")]
scales = [0.5, 1]

ad = AutoDrawer.load_images(client, positions, images, scales, one_by_one=True)
ad.draw()
```

This will proceed to start drawing the images in order they were passed. You could also
set `one_by_one` to `False`, which would cause the images to instead be drawn by pixel
from each, i.e. 1st pixel from img1, 1st pixel from img2, 2nd from img1, 2nd from img2, ...

### Collaborate on image drawing

You can share the load of drawing a single image between multiple joined clients.
This will mean each client will only ever work on it's part of given image, both when guarding and drawing it.

```py
from PIL import Image
from pydispix import DistributedClient, DistributedAutoDrawer

# First machine
multi_client = DistributedClient('pixels_api_key', total_tasks=2 ,controlled_tasks=[0])
# Second machine
#multi_client = MultiClient('pixels_api_key2', total_tasks=2 ,controlled_tasks=[1])

image = Image.open('my_img.png')
auto_drawer = DistributedAutoDrawer.load_image(multi_client, (2, 10), image, scale=0.8)
auto_drawer.draw(guard=True)
```

`total_tasks` is the number of clients you will have in total, i.e. the number of workers
for shared tasks. It's how many groups will the shared pixels be split into.

`controlled_tasks` are the groups controlled by this `MultiClient` instance. This is usually
only 1 task, but you can specify multiple tasks and split the code further.

### Churches

Churches are groups of people collaborating on some image, or set of images on the canvas.
It's basically a big botnet of people. Most popular church is currently the
[Church Of Rick](https://pixel-tasks.scoder12.repl.co/). Churches provide it's members with
tasks to fill certain pixels, and the members finish those tasks and report it back to the church.
This is how you run a single task like this with Church of Rick:

```py
from pydispix.churches import RickChurchClient

client = RickChurchClient(pixels_api_token, rick_church_api_token)
client.run_task(show_progress=True)
```

Church of SQLite is also supported, and they don't require an API key, it is free for everyone:

```py
from pydispix.churches import SQLiteChurchClient

client = SQLiteChurchClient(pixels_api_token)
client.run_task()
```

### Continually running church tasks

If you wish to keep running church tasks continually in a loop, make sure to use `client.run_tasks()`,
avoid `client.run_task()` since it doesn't handle any errors specific to the used church,
`client.run_tasks()` will handle these errors cleanly and log the problems if some ocurred.

Note: `client.run_tasks()` only handles known exceptions, there might still be some exceptions that a church
could raise which aren't handled. If you manage to find one make sure to file an issue about it.

Example of safe continual script to keep running church tasks on your machine:

```py
import pickle
import time
from pydispix.churches import RickChurchClient

client = RickChurchClient(pixels_api_token, rick_church_api_token)

exception_amt = 0
while True:
    try:
        client.run_tasks(show_progress=True)
    except Exception as exc:
        print(f"Exception ocurred: {exc} (#{exception_amt})")
        with open(f"exception{exception_amt}.pickle", "wb") as f:
            pickle.dump(exc, f)
        exception_amt += 1
        time.sleep(5)
```

There is still exception handling here, but it shouldn't capture any, it's only here since you'll
likely not be there to monitor the process all the time, so even in the rare case that something
were to occur, the program will keep running and the exception will stored with pickle.

If you see that this happened (if you find `exceptionX.pickle` files in your working directory),
load the pickled exception and examine what exactly happened. Upload the traceback with the issue.

```py
import pickle

with open("exception0.pickle", "rb") as f:
  exc = pickle.load(f)

raise exc
```

**Important: do not upload the pickle file anywhere, it contains the request, which includes your
API keys, uploading the pickled file would inevitable lead to leaked API key.**

### Other churches

You can also implement your own church according to it's specific API requirements, if you're
interested in doing this, check the [church.py](pydispix/church.py) and how the specific churches
are implemented using it: [churches.py](pydispix/churches.py).

If you do end up implementing it, feel free to also open a pull request and add it, if the church
is popular enough, you have a good chance of it being added to official `pydispix`.

### Progress bars

Every request that has rate limits can now display a progress bar while it's sleeping on cooldown:

```py
pixel = client.get_pixel(0, 0, show_progress=True)
canvas = client.get_canvas(show_progress=True)
client.put_pixel(52, 10, "FFFFFF", show_progress=True)
```

https://user-images.githubusercontent.com/20902250/119607092-418e4200-bde3-11eb-9ac5-4e455ffd47c2.mp4

### Logging

To see logs, you can set the `DEBUG` environment variable, which changes the loglevel from `logging.INFO` to `logging.DEBUG`
You can also do this manually by executing:

```py
import logging

logger = logging.getLogger("pydispix")
logger.setLevel(logging.DEBUG)
```


%package help
Summary:	Development documents and examples for pydispix
Provides:	python3-pydispix-doc
%description help
# PyDisPix

[![made-with-python](https://img.shields.io/badge/Made%20with-Python%203.8+-ffe900.svg?longCache=true&style=flat-square&colorB=00a1ff&logo=python&logoColor=88889e)](https://www.python.org/)
[![MIT](https://img.shields.io/badge/Licensed%20under-MIT-red.svg?style=flat-square)](./LICENSE)
[![Validation](https://github.com/ItsDrike/pydispix/actions/workflows/validation.yml/badge.svg)](https://github.com/ItsDrike/pydispix/actions/workflows/validation.yml)

A simple wrapper around [Python Discord Pixels](https://pixels.pythondiscord.com).
Check it out on [PyPI](https://pypi.org/project/pydispix/).

## Examples

### Main usage

```py
import pydispix

# Create a client with your token.
client = pydispix.Client('my-auth-token')

# Fetch a specific pixel.
print(client.get_pixel(4, 10))

# Draw a pixel.
client.put_pixel(50, 10, 'cyan')
client.put_pixel(1, 5, pydispix.Color.BLURPLE)
client.put_pixel(100, 4, '93FF00')
client.put_pixel(44, 0, 0xFF0000)
client.put_pixel(8, 54, (255, 255, 255))
```

### Canvas

We can also work with the whole pixels canvas

```py
# Fetch the canvas
canvas = client.get_canvas()

# Show the canvas using matplotlib, this will include coordinates
canvas.show()

# Save the canvas to a file
canvas.save('canvas.png')

# And access pixels from it.
print(canvas[4, 10])
```

### Draw image from png

Load an image:

```py
from PIL import Image

im = Image.open('pretty.png')
ad = pydispix.AutoDrawer.load_image(client, (5, 40), im, scale=0.1)
ad.draw()
```

Auto-draw will avoid colouring already correct pixels, for efficiency.

You can also run this continually with `guard=True` which makes sure that after your image
is drawn, this keeps running to check if it haven't been tampered with, and fixes all non-matching
pixels.

```py
ad.draw(guard=True, guard_delay=2)
```

`guard_delay` is the delay between each full iteration of all pixels. We need to wait since
looping without any changes is almost instant in python, and we don't want to put cpu through that
stress for no reason

### Draw multiple images

You can also draw multiple images one by one

```py
from PIL import Image
from pydispix import Client, AutoDrawer

client = Client("pixels_api_token")

positions = [(52, 14), (120, 54)]
images = [Image("img1.png"), Image("img2.png")]
scales = [0.5, 1]

ad = AutoDrawer.load_images(client, positions, images, scales, one_by_one=True)
ad.draw()
```

This will proceed to start drawing the images in order they were passed. You could also
set `one_by_one` to `False`, which would cause the images to instead be drawn by pixel
from each, i.e. 1st pixel from img1, 1st pixel from img2, 2nd from img1, 2nd from img2, ...

### Collaborate on image drawing

You can share the load of drawing a single image between multiple joined clients.
This will mean each client will only ever work on it's part of given image, both when guarding and drawing it.

```py
from PIL import Image
from pydispix import DistributedClient, DistributedAutoDrawer

# First machine
multi_client = DistributedClient('pixels_api_key', total_tasks=2 ,controlled_tasks=[0])
# Second machine
#multi_client = MultiClient('pixels_api_key2', total_tasks=2 ,controlled_tasks=[1])

image = Image.open('my_img.png')
auto_drawer = DistributedAutoDrawer.load_image(multi_client, (2, 10), image, scale=0.8)
auto_drawer.draw(guard=True)
```

`total_tasks` is the number of clients you will have in total, i.e. the number of workers
for shared tasks. It's how many groups will the shared pixels be split into.

`controlled_tasks` are the groups controlled by this `MultiClient` instance. This is usually
only 1 task, but you can specify multiple tasks and split the code further.

### Churches

Churches are groups of people collaborating on some image, or set of images on the canvas.
It's basically a big botnet of people. Most popular church is currently the
[Church Of Rick](https://pixel-tasks.scoder12.repl.co/). Churches provide it's members with
tasks to fill certain pixels, and the members finish those tasks and report it back to the church.
This is how you run a single task like this with Church of Rick:

```py
from pydispix.churches import RickChurchClient

client = RickChurchClient(pixels_api_token, rick_church_api_token)
client.run_task(show_progress=True)
```

Church of SQLite is also supported, and they don't require an API key, it is free for everyone:

```py
from pydispix.churches import SQLiteChurchClient

client = SQLiteChurchClient(pixels_api_token)
client.run_task()
```

### Continually running church tasks

If you wish to keep running church tasks continually in a loop, make sure to use `client.run_tasks()`,
avoid `client.run_task()` since it doesn't handle any errors specific to the used church,
`client.run_tasks()` will handle these errors cleanly and log the problems if some ocurred.

Note: `client.run_tasks()` only handles known exceptions, there might still be some exceptions that a church
could raise which aren't handled. If you manage to find one make sure to file an issue about it.

Example of safe continual script to keep running church tasks on your machine:

```py
import pickle
import time
from pydispix.churches import RickChurchClient

client = RickChurchClient(pixels_api_token, rick_church_api_token)

exception_amt = 0
while True:
    try:
        client.run_tasks(show_progress=True)
    except Exception as exc:
        print(f"Exception ocurred: {exc} (#{exception_amt})")
        with open(f"exception{exception_amt}.pickle", "wb") as f:
            pickle.dump(exc, f)
        exception_amt += 1
        time.sleep(5)
```

There is still exception handling here, but it shouldn't capture any, it's only here since you'll
likely not be there to monitor the process all the time, so even in the rare case that something
were to occur, the program will keep running and the exception will stored with pickle.

If you see that this happened (if you find `exceptionX.pickle` files in your working directory),
load the pickled exception and examine what exactly happened. Upload the traceback with the issue.

```py
import pickle

with open("exception0.pickle", "rb") as f:
  exc = pickle.load(f)

raise exc
```

**Important: do not upload the pickle file anywhere, it contains the request, which includes your
API keys, uploading the pickled file would inevitable lead to leaked API key.**

### Other churches

You can also implement your own church according to it's specific API requirements, if you're
interested in doing this, check the [church.py](pydispix/church.py) and how the specific churches
are implemented using it: [churches.py](pydispix/churches.py).

If you do end up implementing it, feel free to also open a pull request and add it, if the church
is popular enough, you have a good chance of it being added to official `pydispix`.

### Progress bars

Every request that has rate limits can now display a progress bar while it's sleeping on cooldown:

```py
pixel = client.get_pixel(0, 0, show_progress=True)
canvas = client.get_canvas(show_progress=True)
client.put_pixel(52, 10, "FFFFFF", show_progress=True)
```

https://user-images.githubusercontent.com/20902250/119607092-418e4200-bde3-11eb-9ac5-4e455ffd47c2.mp4

### Logging

To see logs, you can set the `DEBUG` environment variable, which changes the loglevel from `logging.INFO` to `logging.DEBUG`
You can also do this manually by executing:

```py
import logging

logger = logging.getLogger("pydispix")
logger.setLevel(logging.DEBUG)
```


%prep
%autosetup -n pydispix-1.2.1

%build
%py3_build

%install
%py3_install
install -d -m755 %{buildroot}/%{_pkgdocdir}
if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi
if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi
if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi
if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi
pushd %{buildroot}
if [ -d usr/lib ]; then
	find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst
fi
if [ -d usr/lib64 ]; then
	find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst
fi
if [ -d usr/bin ]; then
	find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst
fi
if [ -d usr/sbin ]; then
	find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst
fi
touch doclist.lst
if [ -d usr/share/man ]; then
	find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst
fi
popd
mv %{buildroot}/filelist.lst .
mv %{buildroot}/doclist.lst .

%files -n python3-pydispix -f filelist.lst
%dir %{python3_sitelib}/*

%files help -f doclist.lst
%{_docdir}/*

%changelog
* Mon May 29 2023 Python_Bot <Python_Bot@openeuler.org> - 1.2.1-1
- Package Spec generated