ProjZ
A simple asynchronous library for interaction with Project Z
Installation
pip install projz.py
Example - login and get object id from link
import projz
from asyncio import get_event_loop
client = projz.Client()
async def main():
result = await client.login_email("your email", "your password")
print(f"Logged in to account with nickname {result.user_profile.nickname}")
info = await client.get_link_info("link here")
print(f"Object id: {info.object_id}, object type: {info.object_type}")
if __name__ == "__main__":
get_event_loop().run_until_complete(main())
Example - login and post blog
import projz
from asyncio import get_event_loop
from aiofiles import open as async_open
client = projz.Client()
async def main():
result = await client.login_email("your email", "your password")
print(f"Logged in to account with nickname {result.user_profile.nickname}")
circle_link_info = await client.get_link_info(input("Circle link: "))
await client.post_blog(
"Blog title",
"Blog content",
content_rich_format=projz.RichFormatBuilder().h1(0, 4).build(),
cover=await client.upload_file(await async_open("cover-file.png", "rb"), projz.EUploadTarget.FOREGROUND),
background=await client.upload_file(await async_open("bg-file.png", "rb"), projz.EUploadTarget.BACKGROUND),
circle_list=[circle_link_info.object_id]
)
if __name__ == "__main__":
get_event_loop().run_until_complete(main())
Example - receive messages
import projz
from asyncio import get_event_loop
client = projz.Client()
@client.on_message()
async def handle_echo(message: projz.ChatMessage):
if message.content is not None:
await client.send_message(message.thread_id, content=message.content)
# You can specify the command prefix in the arguments of the decorator or Client.
# The slash / is set by default.
@client.on_command("off") # = on_message("/off")
async def handle_off(message: projz.ChatMessage):
await client.change_chat_online_status(message.thread_id, is_online=False)
async def main():
await client.login_email("your email", "your password")
print("Waiting for the messages...")
if __name__ == "__main__":
loop = get_event_loop()
loop.run_until_complete(main())
loop.run_forever()
Addition: Using CLI functions
Print available functions
python -m projz list-actions
Login to an account with email and print info about it
python -m projz login --auth email --login yourlogin --password yourpassword
Or with phone number
python -m projz login --auth phone --login yourlogin --password yourpassword
Get information about the link
python -m projz link-info --auth email --login yourlogin --password yourpassword --info yourlink
Send messages to the chat
python -m projz send-message --auth email --login yourlogin --password yourpassword --thread chatlink --repeat 150
Join to the circle
python -m projz join-circle --auth email --login yourlogin --password yourpassword --circle circlelink
Leave from the circle
python -m projz leave-circle --auth email --login yourlogin --password yourpassword --circle circlelink
Listen for the chat messages
python -m projz listen --auth email --login yourlogin --password yourpassword
Metadata
Release files for ProjZ.py 2.4.7
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| ProjZ.py-2.4.7.tar.gz | 29.9 kB | Without provenance | Details for ProjZ.py-2.4.7.tar.gz |
Release files / ProjZ.py-2.4.7.tar.gz
| Download URL | ProjZ.py-2.4.7.tar.gz |
|---|---|
| Size | 29.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
056f8d9c7d0e1508e41f69ad2940be4c19babf0ee5957d89f3ef6c3cf7c0a629
|
|
BLAKE2b-256 checksum How to use checksums |
488f33f6015589d251e091f652e03134ae6c84504d2b04381f400e405527ad53
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.3
|
Security for ProjZ.py 2.4.7
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.