Skip to main content

Library for using the API for PyWeb AI Moderator.

Project description

PyWebSolutions API Python Library

This is a Python library for interacting with the PyWeb Moderator API. The library provides both synchronous and asynchronous methods for making requests to the PyWeb Moderator API, allowing you to easily integrate PyWebSolutions functionality into your Python applications.

Usage

Synchronous API:

import pyweb_moderator_api

text = "Example text"

with pyweb_moderator_api.SyncAPI(token="your_api_token") as client:
    result = client.getClass(text=text, model="bert")

text_class = result.text_class
time_taken = result.time_taken
confidence = result.confidence
unique_id = result.unique_id
balance = result.balance
label = result.label

print(f"Класс текста: {text_class}\nМетка: {label}\nБыло потрачено времени: {time_taken}\nТочность: {confidence}\nИдентификатор: {unique_id}\nОставшийся баланс: {balance}")

Asynchronous API:

import pyweb_moderator_api
import asyncio

async def main():
    text = "Example text"

    async with pyweb_moderator_api.AsyncAPI(token="your_api_token") as client:
        result = await client.getClass(text=text, model="bert")

    text_class = result.text_class
    time_taken = result.time_taken
    confidence = result.confidence
    unique_id = result.unique_id
    balance = result.balance
    label = result.label

    print(f"Класс текста: {text_class}\nМетка: {label}\nБыло потрачено времени: {time_taken}\nТочность: {confidence}\nИдентификатор: {unique_id}\nОставшийся баланс: {balance}")

asyncio.run(main())

Replace "your_api_token" with your actual API key from telegram bot https://t.me/RuModeratorAI_API_Bot.

API endpoint URL: http://pywebsolutions.ru:30 API documentation: http://pywebsolutions.ru:30/docs

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

pyweb_moderator_api-1.2.0.tar.gz (3.2 kB view hashes)

Uploaded Source

Built Distribution

pyweb_moderator_api-1.2.0-py3-none-any.whl (4.4 kB view hashes)

Uploaded Python 3

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