ProjZ.py


NameProjZ.py JSON
Version 2.4.7 PyPI version JSON
download
home_pagehttps://github.com/D4rkwat3r/ProjZ
SummaryAn asynchronous library for creating scripts and chatbots in Project Z.
upload_time2023-08-10 18:01:33
maintainer
docs_urlNone
authorD4rkwat3r
requires_python>=3.7
license
keywords project-z projectz projz bots api supersymlab projz-bot projz-bots projz-api
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # ProjZ
A simple asynchronous library for interaction with Project Z

## Installation
 ```commandline
 pip install projz.py
 ```

### Example - login and get object id from link
```python3
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

```python3
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
```python3
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
```commandline
python -m projz list-actions
```
### Login to an account with email and print info about it
```commandline
python -m projz login --auth email --login yourlogin --password yourpassword
```
### Or with phone number
```commandline
python -m projz login --auth phone --login yourlogin --password yourpassword
```
### Get information about the link
```commandline
python -m projz link-info --auth email --login yourlogin --password yourpassword --info yourlink
```
### Send messages to the chat
```commandline
python -m projz send-message --auth email --login yourlogin --password yourpassword --thread chatlink --repeat 150
```
### Join to the circle
```commandline
python -m projz join-circle --auth email --login yourlogin --password yourpassword --circle circlelink
```
### Leave from the circle
```commandline
python -m projz leave-circle --auth email --login yourlogin --password yourpassword --circle circlelink
```
### Listen for the chat messages
```commandline
python -m projz listen --auth email --login yourlogin --password yourpassword
```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/D4rkwat3r/ProjZ",
    "name": "ProjZ.py",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": "",
    "keywords": "project-z,projectz,projz,bots,api,supersymlab,projz-bot,projz-bots,projz-api",
    "author": "D4rkwat3r",
    "author_email": "ktoya170214@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/48/8f/33f6015589d251e091f652e03134ae6c84504d2b04381f400e405527ad53/ProjZ.py-2.4.7.tar.gz",
    "platform": null,
    "description": "# ProjZ\r\nA simple asynchronous library for interaction with Project Z\r\n\r\n## Installation\r\n ```commandline\r\n pip install projz.py\r\n ```\r\n\r\n### Example - login and get object id from link\r\n```python3\r\nimport projz\r\nfrom asyncio import get_event_loop\r\n\r\nclient = projz.Client()\r\n\r\n\r\nasync def main():\r\n    result = await client.login_email(\"your email\", \"your password\")\r\n    print(f\"Logged in to account with nickname {result.user_profile.nickname}\")\r\n    info = await client.get_link_info(\"link here\")\r\n    print(f\"Object id: {info.object_id}, object type: {info.object_type}\")\r\n\r\nif __name__ == \"__main__\":\r\n    get_event_loop().run_until_complete(main())\r\n\r\n```\r\n\r\n### Example - login and post blog\r\n\r\n```python3\r\nimport projz\r\nfrom asyncio import get_event_loop\r\nfrom aiofiles import open as async_open\r\n\r\nclient = projz.Client()\r\n\r\n\r\nasync def main():\r\n    result = await client.login_email(\"your email\", \"your password\")\r\n    print(f\"Logged in to account with nickname {result.user_profile.nickname}\")\r\n    circle_link_info = await client.get_link_info(input(\"Circle link: \"))\r\n    await client.post_blog(\r\n        \"Blog title\",\r\n        \"Blog content\",\r\n        content_rich_format=projz.RichFormatBuilder().h1(0, 4).build(),\r\n        cover=await client.upload_file(await async_open(\"cover-file.png\", \"rb\"), projz.EUploadTarget.FOREGROUND),\r\n        background=await client.upload_file(await async_open(\"bg-file.png\", \"rb\"), projz.EUploadTarget.BACKGROUND),\r\n        circle_list=[circle_link_info.object_id]\r\n    )\r\n\r\n\r\nif __name__ == \"__main__\":\r\n    get_event_loop().run_until_complete(main())\r\n```\r\n\r\n### Example - receive messages\r\n```python3\r\nimport projz\r\nfrom asyncio import get_event_loop\r\n\r\nclient = projz.Client()\r\n\r\n\r\n@client.on_message()\r\nasync def handle_echo(message: projz.ChatMessage):\r\n    if message.content is not None:\r\n        await client.send_message(message.thread_id, content=message.content)\r\n\r\n\r\n# You can specify the command prefix in the arguments of the decorator or Client. \r\n# The slash / is set by default.\r\n\r\n\r\n@client.on_command(\"off\")  # = on_message(\"/off\")\r\nasync def handle_off(message: projz.ChatMessage):\r\n    await client.change_chat_online_status(message.thread_id, is_online=False)\r\n\r\n\r\nasync def main():\r\n    await client.login_email(\"your email\", \"your password\")\r\n    print(\"Waiting for the messages...\")\r\n\r\n\r\nif __name__ == \"__main__\":\r\n    loop = get_event_loop()\r\n    loop.run_until_complete(main())\r\n    loop.run_forever()\r\n```\r\n## Addition: Using CLI functions\r\n### Print available functions\r\n```commandline\r\npython -m projz list-actions\r\n```\r\n### Login to an account with email and print info about it\r\n```commandline\r\npython -m projz login --auth email --login yourlogin --password yourpassword\r\n```\r\n### Or with phone number\r\n```commandline\r\npython -m projz login --auth phone --login yourlogin --password yourpassword\r\n```\r\n### Get information about the link\r\n```commandline\r\npython -m projz link-info --auth email --login yourlogin --password yourpassword --info yourlink\r\n```\r\n### Send messages to the chat\r\n```commandline\r\npython -m projz send-message --auth email --login yourlogin --password yourpassword --thread chatlink --repeat 150\r\n```\r\n### Join to the circle\r\n```commandline\r\npython -m projz join-circle --auth email --login yourlogin --password yourpassword --circle circlelink\r\n```\r\n### Leave from the circle\r\n```commandline\r\npython -m projz leave-circle --auth email --login yourlogin --password yourpassword --circle circlelink\r\n```\r\n### Listen for the chat messages\r\n```commandline\r\npython -m projz listen --auth email --login yourlogin --password yourpassword\r\n```\r\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "An asynchronous library for creating scripts and chatbots in Project Z.",
    "version": "2.4.7",
    "project_urls": {
        "Homepage": "https://github.com/D4rkwat3r/ProjZ"
    },
    "split_keywords": [
        "project-z",
        "projectz",
        "projz",
        "bots",
        "api",
        "supersymlab",
        "projz-bot",
        "projz-bots",
        "projz-api"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "488f33f6015589d251e091f652e03134ae6c84504d2b04381f400e405527ad53",
                "md5": "a73767f68be473e3cf2e24c45698a297",
                "sha256": "056f8d9c7d0e1508e41f69ad2940be4c19babf0ee5957d89f3ef6c3cf7c0a629"
            },
            "downloads": -1,
            "filename": "ProjZ.py-2.4.7.tar.gz",
            "has_sig": false,
            "md5_digest": "a73767f68be473e3cf2e24c45698a297",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 29945,
            "upload_time": "2023-08-10T18:01:33",
            "upload_time_iso_8601": "2023-08-10T18:01:33.868697Z",
            "url": "https://files.pythonhosted.org/packages/48/8f/33f6015589d251e091f652e03134ae6c84504d2b04381f400e405527ad53/ProjZ.py-2.4.7.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-08-10 18:01:33",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "D4rkwat3r",
    "github_project": "ProjZ",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [],
    "lcname": "projz.py"
}
        
Elapsed time: 0.18690s