shadapi


Nameshadapi JSON
Version 0.2.0 PyPI version JSON
download
home_pageNone
SummaryRead the latest Real Python tutorials
upload_time2023-01-24 12:09:39
maintainerNone
docs_urlNone
authorHoseanRC
requires_python>=3.7
licenseNone
keywords shad shadapi shadio chat bot robot asyncio
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            <p align="center">
    <a href="https://github.com/HoseanRC/shad-api">
        <img src="https://user-images.githubusercontent.com/68903522/213505965-348da778-36c3-42e0-a31b-7f8711cf18ef.png" alt="Shadpy" width="128">
    </a>
    <br>
    <b>Shad API Framework for Python</b>
    <br>
    <a href="https://github.com/HoseanRC/shad-api">
        Homepage
    </a>
    •
    <a href="https://github.com/HoseanRC/shad-api/raw/master/docs">
        Documentation
    </a>
    •
    <a href="https://pypi.org/project/shadapi/#history">
        Releases
    </a>
</p>

## Shad Api

> Elegant, modern and asynchronous Shad API framework in Python for users and bots
### Accounts

**WebSocket Handler:**
``` python
from shadapi import Client

app = Client('my_account_auth')

@app.handler
async def my_bot(bot, message):
    await message.reply('``Hello`` __from__ **Shad Api**!')
```

**Messages Update Handler:**
``` python
from shadapi import Client

app = Client('my_account_auth')

@app.updateHandler
async def my_bot(bot, message):
    await message.reply('``Hello`` __from__ **Shad Api**!')
```
**OR**
``` python
from shadapi import Client

app = Client('my_account_auth')

update_delay = 5 # in seconds

@app.updateHandler(update_delay)
async def my_bot(bot, message):
    await message.reply('``Hello`` __from__ **Shad Api**!')
```

**Another example:**
``` python
from shadapi import Client

app = Client("my_account_auth")

async def my_bot(bot):
    await bot.sendText('object_guid', '``Hello`` __from__ **Shad Api**!')

app.run(my_bot)
```

### Bots Examples (ONLY FOR SPECIAL MEMBERS) (NOT TESTED)
```python
from shadapi import Bot

app = Bot('token')

async def my_bot(bot):
    me = await bot.getMe()
    print(me)

app.run(my_bot)
```
**OR**
```python
from shadapi import Bot

app = Bot('token')

async def my_bot(bot):
    me = await bot.sendMessage('chat_id', 'text')
    print(me)

app.run(my_bot)
```

**Shad-Api** is a modern, elegant and asynchronous framework. It enables you to easily interact with the main Shad API through a user account (custom client) or a bot
identity (bot API alternative) using Python.


### Key Features

- **Ready**: Install Shad-Api with pip and start building your applications right away.
- **Easy**: Makes the Shad API simple and intuitive, while still allowing advanced usages.
- **Elegant**: Low-level details are abstracted and re-presented in a more convenient way.
- **Fast**: Boosted up by pycryptodome, a high-performance cryptography library written in C.
- **Async**: Fully asynchronous (also usable synchronously if wanted, for convenience).
- **Powerful**: Full access to Shad's API to execute any official client action and more.

### Installing

``` bash
pip3 install shadapi
```

## Notes

### broken message handler

when using this library for fethcing messages from a chat, the library will start a WebSocket channel with the server, and because of the present lag in the server, some of the messages will not be sent by the server and wont be processed by the client (this is not an issue with the library, it's from the server! this problem also do exist in the Android and Web versions of Shad)
we can kindof fix this problem by loading every last message every once in a while to ensure that the client have recived every message, but this would make the bot use more internet (around 277MB per day for maden requests every 2 seconds). the problem with this bypass is that the server would consider that as "request spam" (aka DDOS) and will refuse to response to most of the requests, and this would make the bot pretty much slower! i did implement this functionality in the library and with the addition of "request delay", but until shad devs fix the main issue inside the server or until i find an actuall bypass solution, this are the only ways to handle messages in this library.

| Request method         | advantages                | disadvantage          |
|------------------------|---------------------------|-----------------------|
| WebSocket syncing      | instant trigger           | ignores most messages |
| getChatUpdates request | triggers on every message | slow trigger          |

## Thanks to:

### shayanheidari01

he did an awesome job at making a rubika library which helped alot to make this project!
https://github.com/shayanheidari01/rubika

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "shadapi",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": null,
    "keywords": "shad,shadapi,shadio,chat,bot,robot,asyncio",
    "author": "HoseanRC",
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/08/8c/2af80cd9a9b4d79a9c3e882ab3f9e23d871c083e8f3a3d4a7ca4df9fe6eb/shadapi-0.2.0.tar.gz",
    "platform": null,
    "description": "<p align=\"center\">\n    <a href=\"https://github.com/HoseanRC/shad-api\">\n        <img src=\"https://user-images.githubusercontent.com/68903522/213505965-348da778-36c3-42e0-a31b-7f8711cf18ef.png\" alt=\"Shadpy\" width=\"128\">\n    </a>\n    <br>\n    <b>Shad API Framework for Python</b>\n    <br>\n    <a href=\"https://github.com/HoseanRC/shad-api\">\n        Homepage\n    </a>\n    \u2022\n    <a href=\"https://github.com/HoseanRC/shad-api/raw/master/docs\">\n        Documentation\n    </a>\n    \u2022\n    <a href=\"https://pypi.org/project/shadapi/#history\">\n        Releases\n    </a>\n</p>\n\n## Shad Api\n\n> Elegant, modern and asynchronous Shad API framework in Python for users and bots\n### Accounts\n\n**WebSocket Handler:**\n``` python\nfrom shadapi import Client\n\napp = Client('my_account_auth')\n\n@app.handler\nasync def my_bot(bot, message):\n    await message.reply('``Hello`` __from__ **Shad Api**!')\n```\n\n**Messages Update Handler:**\n``` python\nfrom shadapi import Client\n\napp = Client('my_account_auth')\n\n@app.updateHandler\nasync def my_bot(bot, message):\n    await message.reply('``Hello`` __from__ **Shad Api**!')\n```\n**OR**\n``` python\nfrom shadapi import Client\n\napp = Client('my_account_auth')\n\nupdate_delay = 5 # in seconds\n\n@app.updateHandler(update_delay)\nasync def my_bot(bot, message):\n    await message.reply('``Hello`` __from__ **Shad Api**!')\n```\n\n**Another example:**\n``` python\nfrom shadapi import Client\n\napp = Client(\"my_account_auth\")\n\nasync def my_bot(bot):\n    await bot.sendText('object_guid', '``Hello`` __from__ **Shad Api**!')\n\napp.run(my_bot)\n```\n\n### Bots Examples (ONLY FOR SPECIAL MEMBERS) (NOT TESTED)\n```python\nfrom shadapi import Bot\n\napp = Bot('token')\n\nasync def my_bot(bot):\n    me = await bot.getMe()\n    print(me)\n\napp.run(my_bot)\n```\n**OR**\n```python\nfrom shadapi import Bot\n\napp = Bot('token')\n\nasync def my_bot(bot):\n    me = await bot.sendMessage('chat_id', 'text')\n    print(me)\n\napp.run(my_bot)\n```\n\n**Shad-Api** is a modern, elegant and asynchronous framework. It enables you to easily interact with the main Shad API through a user account (custom client) or a bot\nidentity (bot API alternative) using Python.\n\n\n### Key Features\n\n- **Ready**: Install Shad-Api with pip and start building your applications right away.\n- **Easy**: Makes the Shad API simple and intuitive, while still allowing advanced usages.\n- **Elegant**: Low-level details are abstracted and re-presented in a more convenient way.\n- **Fast**: Boosted up by pycryptodome, a high-performance cryptography library written in C.\n- **Async**: Fully asynchronous (also usable synchronously if wanted, for convenience).\n- **Powerful**: Full access to Shad's API to execute any official client action and more.\n\n### Installing\n\n``` bash\npip3 install shadapi\n```\n\n## Notes\n\n### broken message handler\n\nwhen using this library for fethcing messages from a chat, the library will start a WebSocket channel with the server, and because of the present lag in the server, some of the messages will not be sent by the server and wont be processed by the client (this is not an issue with the library, it's from the server! this problem also do exist in the Android and Web versions of Shad)\nwe can kindof fix this problem by loading every last message every once in a while to ensure that the client have recived every message, but this would make the bot use more internet (around 277MB per day for maden requests every 2 seconds). the problem with this bypass is that the server would consider that as \"request spam\" (aka DDOS) and will refuse to response to most of the requests, and this would make the bot pretty much slower! i did implement this functionality in the library and with the addition of \"request delay\", but until shad devs fix the main issue inside the server or until i find an actuall bypass solution, this are the only ways to handle messages in this library.\n\n| Request method         | advantages                | disadvantage          |\n|------------------------|---------------------------|-----------------------|\n| WebSocket syncing      | instant trigger           | ignores most messages |\n| getChatUpdates request | triggers on every message | slow trigger          |\n\n## Thanks to:\n\n### shayanheidari01\n\nhe did an awesome job at making a rubika library which helped alot to make this project!\nhttps://github.com/shayanheidari01/rubika\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Read the latest Real Python tutorials",
    "version": "0.2.0",
    "split_keywords": [
        "shad",
        "shadapi",
        "shadio",
        "chat",
        "bot",
        "robot",
        "asyncio"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "6526a3819f1d45064ad7c5c5a2d47e77ba78a05859e6d896047ec609a630c689",
                "md5": "3be14fcb589e5dc316fcd3403f47ad4a",
                "sha256": "c4f790159a1960c4662f843b05a2accdc4099277d22e4c2485ca78b90ce984b5"
            },
            "downloads": -1,
            "filename": "shadapi-0.2.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "3be14fcb589e5dc316fcd3403f47ad4a",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 28586,
            "upload_time": "2023-01-24T12:09:32",
            "upload_time_iso_8601": "2023-01-24T12:09:32.928868Z",
            "url": "https://files.pythonhosted.org/packages/65/26/a3819f1d45064ad7c5c5a2d47e77ba78a05859e6d896047ec609a630c689/shadapi-0.2.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "088c2af80cd9a9b4d79a9c3e882ab3f9e23d871c083e8f3a3d4a7ca4df9fe6eb",
                "md5": "618baad874e2f511f38f6bb25d541f4d",
                "sha256": "0b18d8e5fef98f2ec6f6087a4c795dea4d5319b7bdd508fbe25c54f0085bd2de"
            },
            "downloads": -1,
            "filename": "shadapi-0.2.0.tar.gz",
            "has_sig": false,
            "md5_digest": "618baad874e2f511f38f6bb25d541f4d",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 139881,
            "upload_time": "2023-01-24T12:09:39",
            "upload_time_iso_8601": "2023-01-24T12:09:39.382617Z",
            "url": "https://files.pythonhosted.org/packages/08/8c/2af80cd9a9b4d79a9c3e882ab3f9e23d871c083e8f3a3d4a7ca4df9fe6eb/shadapi-0.2.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-01-24 12:09:39",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "lcname": "shadapi"
}
        
Elapsed time: 0.03358s