An API wrapper for the python discord pixels project
Project description
Pythonpixels
An API wrapper for the python discord pixels project
Requirements
pillow, rich and request are required for this library. These are automatically installed with this library.
Usage
Getting started
First make an instance of the Client class and pass your token to the contructor. Everything in this library is done from the Client class.
import pythonpixels
client = pythonpixels.Client("TOKEN") # Your token must be inserted where it says TOKEN
Methods
client.get_pixel(x, y)
Returns the hexadecimal color code of the given pixel
Params: x: int - The x position of the pixel y: int - The y position of the pixel
Returns: int - The color of the requested pixel
client.get_canvas(scale)
Fetch the entire canvas and returns it as a pillow Image instance. Optionally resize it by a scale factor
Params: scale: int - A factor to resize the image by
Returns: pillow.Image - The current canvas
client.get_size()
Returns the size of the canvas
Params: None
Returns: tuple - The width and height of the canvas
client.set_pixel(x, y, color)
Sets a pixel on the canvas
Params: x: int - The x position of the pixel y: int - The y position of the pixel color: int - the RGB colorcode of the pixel
Returns: None
client.set_picture(x, y, img)
Starts a job to add a picture with offset x an y. Img can either be a file directory, an direct URL (Only HTTP supported) or a pillow.Image
Params: x: int - The x offset y: int- The y offset img: typing.Union[str, pillow.Image.Image] - The image to upload. Can either be a path, a HTTP direct image link or a pillow image instance
Returns: None
client.get_limits()
Return the last known rate limits of the API. These are refreshed every request.
Params: None
Returns: dict - A dictionary with the rate limits formatted as follow "set_pixel": tuple(remaining, timeout) "get_pixel": tuple(remaining, timeout) "get_canvas": tuple(remaining, timeout)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pythonpixels-1.2.14.tar.gz.
File metadata
- Download URL: pythonpixels-1.2.14.tar.gz
- Upload date:
- Size: 4.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.9.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
40fee5f6644f1c49ee7b21bb09682e6a8bd57a59bdc25fa11dc15500926c54d2
|
|
| MD5 |
e597d8579836df9fad84f442764858b7
|
|
| BLAKE2b-256 |
4f22ce2a6d91c47ea7c37b09628039e15d6061b3a37f101837cde1c45798a417
|
File details
Details for the file pythonpixels-1.2.14-py3.9.egg.
File metadata
- Download URL: pythonpixels-1.2.14-py3.9.egg
- Upload date:
- Size: 8.8 kB
- Tags: Egg
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.9.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
532ebb37b2d8fbb4a7e258e509f711eb601a05174293fedf9c9da73a9e4a3143
|
|
| MD5 |
1df76d11550511b71864d7a8d7b8c9bb
|
|
| BLAKE2b-256 |
fe8b10df79e83d8de7842e2a3162f8d1a6031a66d94ed8aaa0f5b3ebc13fa8e8
|
File details
Details for the file pythonpixels-1.2.14-py3-none-any.whl.
File metadata
- Download URL: pythonpixels-1.2.14-py3-none-any.whl
- Upload date:
- Size: 5.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.9.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9dda09cc7dc0c61f6f0417e73f85b39e395755d0f5fd62d1d6cf2da8415f17d1
|
|
| MD5 |
ca4ec7159a0467c8c4bc3bef23a46bcc
|
|
| BLAKE2b-256 |
d12fb6ecd96a39f8ad4eece29e7208d787470f462df8105e6347ceda8f374c64
|