Skip to main content

A Python client and CLI for the Cogfy API

This project has been archived.

The maintainers of this project have marked this project as archived. No new releases are expected.

Project description

Cogfy Python Lib

Cogfy é um cliente Python e CLI para a API Cogfy. Ele permite que você interaja com a API Cogfy para gerenciar coleções, registros e obter respostas de chat.

Instalação

Via pip

Você pode instalar o pacote diretamente do repositório usando pip:

pip install cogfy

Via setup.py

Clone o repositório e instale o pacote:

git clone https://github.com/IndigoHive/cogfy-python.git
cd cogfy
pip install .

Configuração

Cogfy CLI usa variáveis de ambiente para configurar a URL base e a chave da API. Você pode definir essas variáveis de ambiente no seu sistema:

export COGFY_BASE_URL=https://api.cogfy.com
export COGFY_API_KEY=your_api_key

Uso

Como Biblioteca

Você pode usar o Cogfy como uma biblioteca em seu código Python:

import cogfy

client = cogfy.CogfyClient(base_url='https://api.cogfy.com', api_key='your_api_key')

# Obter todas as coleções

collections = client.get_collections()

print(collections)

# Obter uma coleção específica

collection = client.get_collection('collection_id')

print(collection)

Como CLI

Cogfy também pode ser usado como uma ferramenta de linha de comando (CLI). Após a instalação, você pode usar o comando cogfy:

cogfy collections list

Comandos Disponíveis

collections list: Obter todas as coleções.

collections get <collection_id>: Obter uma coleção específica.

records list <collection_id>: Obter todos os registros em uma coleção.

records create <collection_id> <properties>: Criar um novo registro em uma coleção. As propriedades devem ser fornecidas em formato JSON.

records delete <collection_id> <record_id>: Excluir um registro específico.

chats response <collection_id> <message> [--message_data <message_data>] [--chat_id <chat_id>]: Obter resposta de chat. message_data deve ser fornecido em formato JSON, se necessário.

Exemplo de Uso da CLI

# Obter todas as coleções

cogfy collections list

# Obter uma coleção específica

cogfy collections get collection_id

# Obter todos os registros em uma coleção

cogfy records list collection_id

# Criar um novo registro em uma coleção

cogfy records create collection_id '{"property": "value"}'

# Excluir um registro específico

cogfy records delete collection_id record_id

# Obter resposta de chat

cogfy chats response collection_id "Hello world!" --message_data '{"key": "value"}' --chat_id chat_id

Testes

Para executar os testes, você pode usar o unittest:

python -m unittest discover -s tests

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

cogfy-0.1.0.tar.gz (3.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cogfy-0.1.0-py3-none-any.whl (3.1 kB view details)

Uploaded Python 3

File details

Details for the file cogfy-0.1.0.tar.gz.

File metadata

  • Download URL: cogfy-0.1.0.tar.gz
  • Upload date:
  • Size: 3.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.6

File hashes

Hashes for cogfy-0.1.0.tar.gz
Algorithm Hash digest
SHA256 d9fb7d2452b8d5190c2798927eed97520949dae557363b0287de81a03db630af
MD5 2655c098ecfc3daac2e09ff60f348dea
BLAKE2b-256 c4940326b5d1efdddfc2bd7315ebfc838373458168f5acb2f447e9c59ed143fa

See more details on using hashes here.

File details

Details for the file cogfy-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: cogfy-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 3.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.6

File hashes

Hashes for cogfy-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a7e56f2df7b90afa50188a686fc498ea80fc7acca5dcd62337db710d9ef6ce12
MD5 05fe79a25d5115a438c59798d2324f33
BLAKE2b-256 dd2ab588300e784800ef13ed12cd6ea37289b047f68637e46b89bf5511b9c9ef

See more details on using hashes here.

Supported by

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