Skip to main content

A Python client for the SuperPrompter Web Search API

Project description

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:

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.

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.

# 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?

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

superprompter_sdk-0.2.0.tar.gz (4.4 kB view details)

Uploaded Source

Built Distribution

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

superprompter_sdk-0.2.0-py3-none-any.whl (4.8 kB view details)

Uploaded Python 3

File details

Details for the file superprompter_sdk-0.2.0.tar.gz.

File metadata

  • Download URL: superprompter_sdk-0.2.0.tar.gz
  • Upload date:
  • Size: 4.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for superprompter_sdk-0.2.0.tar.gz
Algorithm Hash digest
SHA256 b3d2e54c0a072ad5c6693cd70638ebf6584b4b5eb85215d569e1487a98d57708
MD5 018e26d58c77c3382744c1447fc328e6
BLAKE2b-256 7f233bfeb507d3c5a6c6e01c72e6801a34e084bfa4c8b6106d9fd8b4e8cd2986

See more details on using hashes here.

File details

Details for the file superprompter_sdk-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for superprompter_sdk-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9d0794e5ac38ded5a44934dae3f624e44df1e8fd27fc80017d988c60d9847a2b
MD5 88bfcc67d2e3399725c38be586f49c0d
BLAKE2b-256 5ad2ea57efb5e9f97059ee10db01b5a8c98655d9251cba5a6e43aa2b53b97f27

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