A client for the Signal stickers API
Project description
Python client for Signal stickers
A client to interact with the Signal stickers API.
- Fetch sticker packs
- Get images files
- etc.
Note: despite its name, this client does not interacts with
signalstickers.com
, so information defined there (tags, etc.) will not be fetched.
This client connects to the Signal sticker API. Please do not flood it.
Installation
pip install --user signalstickers-client
This module requires cryptography
(but it should be installed with the
previous command).
Usage
The StickerPack
object returned by StickersClient().get_pack(<pack_id>, <pack_key>)
exposes the following attributes:
id
(string): the pack id. Equals topack_id
;key
(string): the pack key. Equals topack_key
;title
(string): the title of the pack;author
(string): the author of the pack;nb_stickers
(int): the number of stickers in the pack;cover
(Sticker
): the cover sticker;stickers
(list): the list of stickers in the pack (which areSticker
objects).
A Sticker
object exposes the following attributes:
id
(int): the id of the sticker in the pack;emoji
(string): the emoji mapped to this sticker;image_data
(bytes): the webp image of the sticker.
Example usage
import os
from signalstickers_client import StickersClient
# "Friends of the Internet" by Bits of Freedom
pack_id = "4830e258138fca961ab2151d9596755c"
pack_key = "87078ee421bad8bf44092ca72166b67ae5397e943452e4300ced9367b7f6a1a1"
client = StickersClient()
pack = client.get_pack(pack_id, pack_key)
print(pack.title) # "Friends of the Internet"
print(pack.author) # "Bits of Freedom"
print(pack.nb_stickers) # 7
# Saves all stickers in webp format in /tmp/stickersclient
# if the directory exists
for sticker in pack.stickers:
with open(
os.path.join("/tmp", "stickersclient", "{}.webp".format(sticker.id)), "wb"
) as sticker_f:
sticker_f.write(sticker.image_data)
License
See LICENSE
Legal
This is not an official Signal project. This is an independant project.
Signal is a registered trademark in the United States and other countries.
Author
Romain Ricard contact+stickerclient@romainricard.fr
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 Distribution
Hashes for signalstickers-client-1.0.4.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 81eb6b8db335855554a994e28155172006a90b05e6eb9ec97edb983f18096e7f |
|
MD5 | 3e48739f3a8568908736f56c9e31ae37 |
|
BLAKE2b-256 | b62546d5734d2f4a84b3609c0c088dd6821440e6f2efc698859c4a0988863f3a |
Hashes for signalstickers_client-1.0.4-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0c3cb46a2731a9b57a1b51da732e23ccbd3e5d072f67ab4b9a84ddd93fd32805 |
|
MD5 | f42bb0c9e6d950d8b99e3304dadfbb14 |
|
BLAKE2b-256 | 0bbdbde396141c97fbb7da5933035ff7f526c6275ea84ebcdc3574048e54f990 |