# Sakura Python Client
This is a Python client for the Sakura API. It provides methods to authenticate, send messages, get selfies, and more.
## Installation
You can install the Sakura Python Client using pip:
```bash
pip install sakura-fm
```
## Usage
First, import the `Client` class from the `sakura` package:
```python
from sakura import Client
```
Next, create an instance of the `Client` class, passing your Sakura username, password and mongo uri to the constructor:
```python
client = Client(
username = "your_username",
password = "your_password",
mongo = "your_mongodb_uri"
)
```
Now you can use the methods of the `Client` class to interact with the Sakura API.
## Sending a Message
To send a message, use the `sendMessage` method by passing a random unique integer as UID you want and a character id and prompt:
```python
# https://www.sakura.fm/chat/dmDCgmq
# the parameter after /chat/ is character id (/chat/{char_id})
response = client.sendMessage(1234, 'dmDCgmq', 'Hello Kazuko')
print(response)
```
reponse will return a json like this:
```json
{
"chat_id": "u3q9YN7",
"reply": "*jumps slightly* Oh! Uh, hi there. I didn't see you come in."
}
```
## Getting a Selfie
To get a selfie, use the `get_selfie` method we have to pass that old unique id which we sent in sendMessage:
```python
response = client.get_selfie(1234)
print(response)
```
response will return an image url
## Deleting the database
To delete the databse containing this whole uid to chat id connection, use this function:
```python
response = client.delete_db()
print(response)
```
response will return `True` if it is success
## That's all for now
Raw data
{
"_id": null,
"home_page": "https://github.com/awesome-Tofu/sakura_fm",
"name": "sakura-fm",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": "sakura, sakura.fm, sakura scraper, sakurai",
"author": "Aditya",
"author_email": "adityaraj6311@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/25/e5/bd392047e01df50265d6018e07b5286067cbe0c60fa3134fc3f4c5d7d961/sakura_fm-0.0.9.tar.gz",
"platform": null,
"description": "# Sakura Python Client\r\n\r\nThis is a Python client for the Sakura API. It provides methods to authenticate, send messages, get selfies, and more.\r\n\r\n## Installation\r\n\r\nYou can install the Sakura Python Client using pip:\r\n\r\n```bash\r\npip install sakura-fm\r\n```\r\n\r\n## Usage\r\n\r\nFirst, import the `Client` class from the `sakura` package:\r\n\r\n```python\r\nfrom sakura import Client\r\n```\r\n\r\nNext, create an instance of the `Client` class, passing your Sakura username, password and mongo uri to the constructor:\r\n\r\n```python\r\nclient = Client(\r\n username = \"your_username\",\r\n password = \"your_password\",\r\n mongo = \"your_mongodb_uri\"\r\n)\r\n```\r\n\r\nNow you can use the methods of the `Client` class to interact with the Sakura API.\r\n\r\n## Sending a Message\r\n\r\nTo send a message, use the `sendMessage` method by passing a random unique integer as UID you want and a character id and prompt:\r\n\r\n```python\r\n# https://www.sakura.fm/chat/dmDCgmq\r\n# the parameter after /chat/ is character id (/chat/{char_id})\r\n\r\nresponse = client.sendMessage(1234, 'dmDCgmq', 'Hello Kazuko')\r\nprint(response)\r\n```\r\n\r\nreponse will return a json like this:\r\n```json\r\n{\r\n \"chat_id\": \"u3q9YN7\",\r\n \"reply\": \"*jumps slightly* Oh! Uh, hi there. I didn't see you come in.\"\r\n}\r\n```\r\n\r\n## Getting a Selfie\r\n\r\nTo get a selfie, use the `get_selfie` method we have to pass that old unique id which we sent in sendMessage:\r\n\r\n```python\r\nresponse = client.get_selfie(1234)\r\nprint(response)\r\n```\r\n\r\nresponse will return an image url\r\n\r\n## Deleting the database\r\n\r\nTo delete the databse containing this whole uid to chat id connection, use this function:\r\n\r\n```python\r\nresponse = client.delete_db()\r\nprint(response)\r\n```\r\n\r\nresponse will return `True` if it is success\r\n\r\n## That's all for now\r\n",
"bugtrack_url": null,
"license": null,
"summary": "A simple scraper package for chatting with bots from sakura.fm",
"version": "0.0.9",
"project_urls": {
"Homepage": "https://github.com/awesome-Tofu/sakura_fm"
},
"split_keywords": [
"sakura",
" sakura.fm",
" sakura scraper",
" sakurai"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "65b7403f21793cc7c94bc83b7a124b4cb0f36c87b0c5b90ac84541d96b28eee0",
"md5": "da6ebfb9caf031a8e56961dfd0c9e67e",
"sha256": "be1249b2849c9e49424f31ddcd801cb903ecd28d9d976647b3b9fdc186be27bd"
},
"downloads": -1,
"filename": "sakura_fm-0.0.9-py3-none-any.whl",
"has_sig": false,
"md5_digest": "da6ebfb9caf031a8e56961dfd0c9e67e",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 6021,
"upload_time": "2024-05-30T11:52:51",
"upload_time_iso_8601": "2024-05-30T11:52:51.227125Z",
"url": "https://files.pythonhosted.org/packages/65/b7/403f21793cc7c94bc83b7a124b4cb0f36c87b0c5b90ac84541d96b28eee0/sakura_fm-0.0.9-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "25e5bd392047e01df50265d6018e07b5286067cbe0c60fa3134fc3f4c5d7d961",
"md5": "dd2fb863df304d7c41b1ab80153a7dfc",
"sha256": "deb93e3c5fbb6200004c46e3f42dcab2f51f60ae29bde7d28294cac6224cca09"
},
"downloads": -1,
"filename": "sakura_fm-0.0.9.tar.gz",
"has_sig": false,
"md5_digest": "dd2fb863df304d7c41b1ab80153a7dfc",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 5107,
"upload_time": "2024-05-30T11:52:52",
"upload_time_iso_8601": "2024-05-30T11:52:52.903828Z",
"url": "https://files.pythonhosted.org/packages/25/e5/bd392047e01df50265d6018e07b5286067cbe0c60fa3134fc3f4c5d7d961/sakura_fm-0.0.9.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-05-30 11:52:52",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "awesome-Tofu",
"github_project": "sakura_fm",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "sakura-fm"
}