Skip to main content

A CLI tool to convert natural language to REST API queries.

Project description

nlrest

Description

nlrest is a Python Command Line Interface (CLI) tool that allows users to convert natural language descriptions into REST API queries and execute them. It uses OpenAI's GPT-3.5 Turbo model to interpret natural language and generate the details of the REST API call, including the method, URL, headers, and request body.

Installation

Prerequisites

  • Python 3.6 or higher
  • An OpenAI API key

Install from PyPI

You can install nlrest directly from PyPI:

pip install nlrest

Set Up Environment Variable

Before using nlrest, set the OPENAI_API_KEY environment variable with your OpenAI API key:

export OPENAI_API_KEY='your-api-key-here'

Usage

Basic Usage

To use nlrest, run the command followed by the -p option and your natural language prompt:

nlrest -p "Your natural language instruction here"

Example:

nlrest -p "Fetch the latest news from NewsAPI"

The tool will output the response from the executed REST API call.

Example Prompts

  • "Fetch the latest stock prices from the Finance API."
  • "Post a new message to my social media account saying 'Hello World!'."

Features

  • Converts natural language to REST API query details.
  • Supports various HTTP methods (GET, POST, PUT, DELETE).
  • Executes the REST API requests and displays the response.

Contributing

Contributions to nlrest are welcome! Please feel free to submit pull requests or open issues to improve the tool or add new features.

License

This project is licensed under the MIT License - see the LICENSE file for details.

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

nlrest-0.1.0.tar.gz (2.0 kB view details)

Uploaded Source

Built Distribution

nlrest-0.1.0-py3-none-any.whl (2.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: nlrest-0.1.0.tar.gz
  • Upload date:
  • Size: 2.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.18

File hashes

Hashes for nlrest-0.1.0.tar.gz
Algorithm Hash digest
SHA256 a552154b7fbb47d480715fd5179a25724a5b9ba02b109a8a7320183ab13c55af
MD5 d9f5eee8f8dc0fc539ac39b5691ffeee
BLAKE2b-256 d3ed0ffa1620c4694ae5b37a7f3e31d6033022fb52e50d8af5433617d2e534ea

See more details on using hashes here.

File details

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

File metadata

  • Download URL: nlrest-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 2.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.18

File hashes

Hashes for nlrest-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 76fda0250af211db585ea4060b481a185420bf2b9af5d4e66ceb6a2381f5588d
MD5 99ce73c09bf4e13fb820530bf2f24799
BLAKE2b-256 84e23c958a6d91b27936177266579c059cd57e1daf8fd1f38c4b1ac8b73c53d0

See more details on using hashes here.

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