Skip to main content

A simple scraper package for chatting with bots from sakura.fm

Project description

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:

pip install sakura_fm

Usage

First, import the Client class from the sakura package:

from sakura_fm import Client

Next, create an instance of the Client class, passing your Sakura username, password and mongo uri to the constructor:

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:

# 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:

{
    "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:

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:

response = client.delete_db()
print(response)

response will return True if it is success

That's all for now

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sakura_fm-0.0.5.tar.gz (4.9 kB view details)

Uploaded Source

Built Distribution

sakura_fm-0.0.5-py3-none-any.whl (5.8 kB view details)

Uploaded Python 3

File details

Details for the file sakura_fm-0.0.5.tar.gz.

File metadata

  • Download URL: sakura_fm-0.0.5.tar.gz
  • Upload date:
  • Size: 4.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.12.0

File hashes

Hashes for sakura_fm-0.0.5.tar.gz
Algorithm Hash digest
SHA256 3478fadcdad2bac22eaa9eeaedf7470dd1e789e59a921b2b7a3376ac4f013544
MD5 1334d6758e6bfbdf19a04eeb426a31df
BLAKE2b-256 6b20f472784b4e62aa08169b70959d240ce105cbd1a7bad0a4db3f209188db8e

See more details on using hashes here.

Provenance

File details

Details for the file sakura_fm-0.0.5-py3-none-any.whl.

File metadata

  • Download URL: sakura_fm-0.0.5-py3-none-any.whl
  • Upload date:
  • Size: 5.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.12.0

File hashes

Hashes for sakura_fm-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 5bf3f2914c3992c8a39f3aed2706e8a1fc26dba6b87df36996d3e3bf61be964e
MD5 fb659b577185c51a315f8c2230ffa50a
BLAKE2b-256 52ece5e03d71c8c9e847ba0d2c6aafda137c6cd1df37b157c8d8ca0a4cfee445

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page