# adapt.py
Official wrapper around Adapt's API for Python.
## Installation
```bash
pip install adapt.py
```
From GitHub:
```bash
pip install git+https://github.com/AdaptChat/adapt.py
```
## Usage
```python
import adapt
class Client(adapt.Client):
"""My example client"""
@adapt.once # This event will only be called once
async def on_ready(self, ready: adapt.ReadyEvent) -> None:
print(f"Logged in as {ready.user}!")
async def on_message(self, message: adapt.Message) -> None:
if message.content == "!ping":
await message.channel.send("Pong!")
if __name__ == "__main__":
client = Client()
client.run("token")
```
## Using adapt.py with a custom Adapt instance
Adapt.py defaults to use the official Adapt instance at https://adapt.chat. If you want to use a custom instance,
pass an `AdaptServer` instance to the `server` kwarg when constructing the client.
`AdaptServer.local()` can be used as a shortcut to create a server instance for a local instance of Adapt:
```python
from adapt import AdaptServer, Client
client = Client(server=AdaptServer.local()) # Use a local instance of Adapt
...
```
Or, you can manually pass in URLs:
```python
from adapt import AdaptServer, Client
server = AdaptServer(
api="https://my-adapt-instance.com/api",
harmony="https://my-adapt-instance.com/harmony",
convey="https://my-adapt-instance.com/convey",
)
client = Client(server=server)
...
```
Raw data
{
"_id": null,
"home_page": "https://github.com/AdaptChat/adapt.py",
"name": "adapt.py",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.8.0",
"maintainer_email": "",
"keywords": "",
"author": "jay3332",
"author_email": "",
"download_url": "https://files.pythonhosted.org/packages/3d/e6/c233b26afb06ac8924626259a01292475d764923f4a23da447cd594a2ec6/adapt.py-0.1.0a0.tar.gz",
"platform": null,
"description": "# adapt.py\nOfficial wrapper around Adapt's API for Python.\n\n## Installation\n```bash\npip install adapt.py\n```\n\nFrom GitHub:\n```bash\npip install git+https://github.com/AdaptChat/adapt.py\n```\n\n## Usage\n```python\nimport adapt\n\nclass Client(adapt.Client):\n \"\"\"My example client\"\"\"\n\n @adapt.once # This event will only be called once\n async def on_ready(self, ready: adapt.ReadyEvent) -> None:\n print(f\"Logged in as {ready.user}!\")\n\n async def on_message(self, message: adapt.Message) -> None:\n if message.content == \"!ping\":\n await message.channel.send(\"Pong!\")\n\nif __name__ == \"__main__\":\n client = Client()\n client.run(\"token\")\n```\n\n## Using adapt.py with a custom Adapt instance\nAdapt.py defaults to use the official Adapt instance at https://adapt.chat. If you want to use a custom instance,\npass an `AdaptServer` instance to the `server` kwarg when constructing the client.\n\n`AdaptServer.local()` can be used as a shortcut to create a server instance for a local instance of Adapt:\n\n```python\nfrom adapt import AdaptServer, Client\n\nclient = Client(server=AdaptServer.local()) # Use a local instance of Adapt\n...\n```\n\nOr, you can manually pass in URLs:\n```python\nfrom adapt import AdaptServer, Client\n\nserver = AdaptServer(\n api=\"https://my-adapt-instance.com/api\",\n harmony=\"https://my-adapt-instance.com/harmony\",\n convey=\"https://my-adapt-instance.com/convey\",\n)\nclient = Client(server=server)\n...\n```\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Official wrapper around Adapt's API for Python.",
"version": "0.1.0a0",
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "f7ce289f16bfd74bc3e8280859c26697dc26c446833262dc2eaed5a203899b78",
"md5": "db7ea0d7a25cf015df40380048fa36a6",
"sha256": "71c0e34c6dace4b0b61426324a1ecc7135b62c9387b354b040161f7352f92143"
},
"downloads": -1,
"filename": "adapt.py-0.1.0a0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "db7ea0d7a25cf015df40380048fa36a6",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8.0",
"size": 46477,
"upload_time": "2023-04-12T14:53:30",
"upload_time_iso_8601": "2023-04-12T14:53:30.617215Z",
"url": "https://files.pythonhosted.org/packages/f7/ce/289f16bfd74bc3e8280859c26697dc26c446833262dc2eaed5a203899b78/adapt.py-0.1.0a0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "3de6c233b26afb06ac8924626259a01292475d764923f4a23da447cd594a2ec6",
"md5": "bdf1577921208fbfcb64153256f9356e",
"sha256": "fb75302bfeaa5d82b8bd2d890dfea141978f128e1553c24ce9076baae1f9684b"
},
"downloads": -1,
"filename": "adapt.py-0.1.0a0.tar.gz",
"has_sig": false,
"md5_digest": "bdf1577921208fbfcb64153256f9356e",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8.0",
"size": 37881,
"upload_time": "2023-04-12T14:53:32",
"upload_time_iso_8601": "2023-04-12T14:53:32.709954Z",
"url": "https://files.pythonhosted.org/packages/3d/e6/c233b26afb06ac8924626259a01292475d764923f4a23da447cd594a2ec6/adapt.py-0.1.0a0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-04-12 14:53:32",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "AdaptChat",
"github_project": "adapt.py",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [
{
"name": "aiohttp",
"specs": [
[
">=",
"3.8.0"
]
]
}
],
"lcname": "adapt.py"
}