A client library for the prompts-testing API.
Project description
This file provides a clear overview for anyone who visits your project on GitHub or PyPI.
Markdown
promptsapi
A simple Python client library for interacting with the prompts-testing API.
Installation
You can install promptsapi directly from PyPI using pip:
pip install promptsapi
Usage
The library provides a single, easy-to-use function to generate content from the API.
Example
Here's how to use the generate_prompt function:
Python
from promptsapi import generate_prompt
# Replace with your actual API key
API_KEY = "YOUR_API_KEY_HERE"
# The URL for the generate endpoint
API_URL = "[https://prompts-testing-v1-0.onrender.com/api/v1/generate](https://prompts-testing-v1-0.onrender.com/api/v1/generate)"
# The raw text input for the API
prompt_text = "write a short story about a brave knight"
# Call the function
response = generate_prompt(
api_key=API_KEY,
api_url=API_URL,
raw_input=prompt_text
)
# Print the response if the request was successful
if response:
print(response)
Error Handling
The generate_prompt function handles common errors gracefully. It will print a message to the console and return None if it encounters issues like:
Network timeouts
HTTP errors (e.g., 404 Not Found, 500 Internal Server Error)
Unexpected exceptions
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
promptsapi-0.2.0.tar.gz
(3.0 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file promptsapi-0.2.0.tar.gz.
File metadata
- Download URL: promptsapi-0.2.0.tar.gz
- Upload date:
- Size: 3.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5b7da0371a5564bdb36cd3c77fe312d0be377db1a04510df575ba1b36425a3a2
|
|
| MD5 |
7461ca045f2295a9a7d90f0408303360
|
|
| BLAKE2b-256 |
3eb4ef5d6b3bb0225a106a2b7f2f98f9d03e2ed9d7afbd906c76eb5d3b47bee9
|
File details
Details for the file promptsapi-0.2.0-py3-none-any.whl.
File metadata
- Download URL: promptsapi-0.2.0-py3-none-any.whl
- Upload date:
- Size: 3.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1bf8fb92fa4325a9af2fb104713838e69d4b70b3300ebcf60346ecc6851afe7f
|
|
| MD5 |
5488fe8d588f1e67964c10668c7262aa
|
|
| BLAKE2b-256 |
3ff62ea03d179d4010160e4f2c350edae0a9754f2194f453d2adf7b26a8c9aea
|