A simple Python client for the ULP search API.
Project description
api-ulp
A simple Python client for the ULP search API.
Installation
pip install api-ulp
Requirements
- Python 3.7+
requests>= 2.20.0
Quick Start
from api_ulp import ApiUlp
client = ApiUlp(api_key="YOUR_API_KEY")
results = client.search(query="hello world", limit=10)
print(results)
Usage
Initialize the client
from api_ulp import ApiUlp
client = ApiUlp(api_key="YOUR_API_KEY")
| Parameter | Type | Required | Description |
|---|---|---|---|
api_key |
str | Yes | Your ULP API key |
search(query, limit)
Performs a POST search request against the ULP API.
results = client.search(query="search_target", limit=100)
print(results)
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
query |
str | Yes | — | The search term / target |
limit |
int | No | 100 |
Maximum number of results to return |
Returns: dict — Parsed JSON response from the API.
Error Handling
import requests
from api_ulp import ApiUlp
client = ApiUlp(api_key="YOUR_API_KEY")
try:
results = client.search(query="hello", limit=50)
print(results)
except ValueError as e:
# Bad arguments (empty query, invalid limit, missing key)
print(f"Invalid input: {e}")
except requests.exceptions.HTTPError as e:
# API returned 4xx or 5xx
print(f"API error: {e}")
except requests.exceptions.ConnectionError as e:
# Could not reach the server
print(f"Connection error: {e}")
except requests.exceptions.Timeout as e:
# Request took longer than 30 seconds
print(f"Timeout: {e}")
API Details
| Property | Value |
|---|---|
| Endpoint | POST https://api-1-wi9u.onrender.com/api/search |
| Auth Header | X-API-Key: YOUR_KEY |
| Content-Type | application/json |
| Timeout | 30 seconds |
Raw request equivalent
import requests
url = "https://api-1-wi9u.onrender.com/api/search"
headers = {"X-API-Key": "YOUR_KEY", "Content-Type": "application/json"}
data = {"query": "search_target", "limit": 100}
response = requests.post(url, headers=headers, json=data)
print(response.json())
License
MIT
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
api_ulp-0.1.0.tar.gz
(2.9 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 api_ulp-0.1.0.tar.gz.
File metadata
- Download URL: api_ulp-0.1.0.tar.gz
- Upload date:
- Size: 2.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ea172436eab92a0ffb3de90313b1b6fceb7385b014f330a9252db92309997d71
|
|
| MD5 |
85a43e2faf8ac7a4a0edafe9c86a5991
|
|
| BLAKE2b-256 |
dd4c786f4753c4f8b4b4dc87bef52bb8b3fd19645c41b2daf078d1ef39bd1a5e
|
File details
Details for the file api_ulp-0.1.0-py3-none-any.whl.
File metadata
- Download URL: api_ulp-0.1.0-py3-none-any.whl
- Upload date:
- Size: 3.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2d51f0bdec1f9c2562beec3fedc2a01090d6d3025656b15a828a9506f647ee63
|
|
| MD5 |
cf27a4915769192c786c77266a3cf28c
|
|
| BLAKE2b-256 |
41344f942531a5bac8ab0df132331502baa71739ae175cbcef370f0bb1bf25e6
|