Skip to main content

Asyncio API wrapper for the Travitia Cleverbot API. (https://public-api.travitia.xyz/talk)

Project description

CircleCI Build Status Codestyle PyPI version Issues LICENSE Downloads Python

async_cleverbot

Asyncio API wrapper for the Travitia Cleverbot API. (https://public-api.travitia.xyz/talk)

Installation

pip3 install -U async_cleverbot

Usage

import async_cleverbot as ac

cleverbot = ac.Cleverbot("Your API key here") # Create the Cleverbot client
response = await cleverbot.ask("How are you today?") # Ask a question, returns async_cleverbot.cleverbot.Response
print(response.text) # Text from the Response object
await cleverbot.close()

Getting an API key

Join the Travitia API Discord server and use the > api command to request an API key. Getting a key

Using context

This API supports a context parameter for background context, so let's make use of it!

import async_cleverbot as ac

cleverbot = ac.Cleverbot("Your API key here")
cleverbot.set_context(ac.DictContext(cleverbot)) # Actually adds the context storage

response = await cleverbot.ask("How are you today?", 246938839720001536) # 2nd param is an identifier, this can be a user id!
print(response.text)

response = await cleverbot.ask("I'm doing good too.", 246938839720001536)
print(response.text)
print(cleverbot.context._storage) # "How are you today?"
await cleverbot.close()

Project details


Download files

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

Files for async-cleverbot, version 0.1.2
Filename, size & hash File type Python version Upload date
async_cleverbot-0.1.2.tar.gz (3.7 kB) View hashes Source None

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page