Metadata-Version: 2.4
Name: superprompter-sdk
Version: 0.2.0
Summary: A Python client for the SuperPrompter Web Search API
Author-email: "Sainskrut (sushrut) Kulkarni" <info@promptsgenerator.ai>
Project-URL: Homepage, https://promptsgenerator.ai
Project-URL: Bug Tracker, https://promptsgenerator.ai
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.7
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: requests>=2.25.0
Dynamic: license-file

# SuperPrompter Python SDK

The official Python client for the SuperPrompter Web Search API. This library allows you to search the SuperPrompter News database and integrate real-time news data directly into your Python scripts or AI agents.

## Installation

Install the SDK using pip from your local distribution or private repository:

```bash
pip install superprompter-sdk


Initialize the Client
To get started, you will need an API Key generated by your administrator.

from superprompter import SuperPrompter

# Initialize the client with your secure API key
sdk = SuperPrompter(api_key="sp_live_your_unique_key_here")

Search for News
The search_news method allows you to query the News database. You can specify a search term and limit the number of results.

# Search for the latest AI news
results = sdk.search_news(query="Generative AI", limit=5)

if "error" not in results:
    print(f"Found {results['count']} articles:")
    for item in results['data']:
        print(f"--- {item['title']} ---")
        print(f"URL: {item['url']}")
        print(f"Description: {item['description']}")
else:
    print(f"Error: {results['error']}")

To wrap up your Web Search API project, we will create a professional **README.md**. This serves as the primary documentation for your developers, explaining how to install the library, authenticate, and perform news searches.

### **SuperPrompter Python SDK: Documentation (README.md)**

```markdown
# SuperPrompter Python SDK

The official Python client for the SuperPrompter Web Search API. This library allows you to search the SuperPrompter News database and integrate real-time news data directly into your Python scripts or AI agents.

## Installation

Install the SDK using pip from your local distribution or private repository:

```bash
pip install superprompter-sdk

```

## Quick Start

### 1. Initialize the Client

To get started, you will need an **API Key** generated by your administrator.

```python
from superprompter import SuperPrompter

# Initialize the client with your secure API key
sdk = SuperPrompter(api_key="sp_live_your_unique_key_here")

```

### 2. Search for News

The `search_news` method allows you to query the News database. You can specify a search term and limit the number of results.

```python
# Search for the latest AI news
results = sdk.search_news(query="Generative AI", limit=5)

if "error" not in results:
    print(f"Found {results['count']} articles:")
    for item in results['data']:
        print(f"--- {item['title']} ---")
        print(f"URL: {item['url']}")
        print(f"Description: {item['description']}")
else:
    print(f"Error: {results['error']}")

```

## API Reference

### `SuperPrompter(api_key, base_url=None)`

* `api_key` (str): Your secret `sp_live_` token.
* `base_url` (str, optional): The endpoint URL of your SuperPrompter instance.

### `client.search_news(query, limit=10)`

* `query` (str): The keyword or phrase to search for in titles and descriptions.
* `limit` (int): Number of results to return (Default: 10, Max: 50).

## Error Handling

The SDK returns a dictionary containing an `error` key if a request fails. Common reasons include:

* **401 Unauthorized**: Invalid or missing API Key.
* **403 Forbidden**: Your account is locked by an administrator.
* **429 Too Many Requests**: You have exceeded your daily limit.

```

---

### **How to Use the SDK in a Python Environment**

To use this in a real-world scenario (like a Jupyter Notebook or a local script), the workflow for your developer is as follows:



1.  **Environment Setup**: The developer creates a virtual environment and installs the `.whl` file we created in Step 6.
2.  **Authentication**: They log into the SuperPrompter Admin panel (or receive the key from you) and copy their `sp_live_...` key.
3.  **Data Retrieval**: They run the script.
    * **The SDK** handles the `X-API-KEY` header and URL formatting.
    * **The Flask Server** validates the key, queries the `News` database, and logs the request.
    * **The Developer** receives a clean JSON object containing titles, URLs, and descriptions, ready to be fed into their local LLM or analysis tool.

### **Project Completion Summary**
You now have a complete, professional API ecosystem:
* **Admin Dashboard**: To manage keys and user access.
* **Performance Logs**: To monitor latency and traffic.
* **Secure API Endpoint**: Exposing your `News` database.
* **Distributable Python Library**: For seamless developer integration.

**Everything is now ready for deployment!** Is there any specific part of the code or flow you'd like to refine further before you launch?

```
