
Security News
MCP Community Begins Work on Official MCP Metaregistry
The MCP community is launching an official registry to standardize AI tool discovery and let agents dynamically find and install MCP servers.
TinyRetriever is a lightweight synchronous wrapper for AIOHTTP that abstracts away the complexities of making asynchronous HTTP requests. It is designed to be simple, easy to use, and efficient. TinyRetriever is built on top of AIOHTTP and AIOFiles, which are popular asynchronous HTTP client and file management libraries for Python.
📚 Full documentation is available here.
TinyRetriever provides the following features:
orjson
when
available for up to 14x faster JSON parsingTinyRetriever does not use nest-asyncio
, instead it creates and manages a dedicated
thread for running the event loop. This allows you to use TinyRetriever in Jupyter
notebooks and other environments where the event loop is already running.
There are three main functions in TinyRetriever:
download
: Download files concurrently;fetch
: Fetch queries concurrently and return responses as text, JSON, or binary;unique_filename
: Generate unique filenames based on query parameters.Choose your preferred installation method:
pip
pip install tiny-retriever
micromamba
micromamba install -c conda-forge tiny-retriever
Alternatively, you can use conda
or mamba
.
Please refer to the documentation for detailed usage instructions and more elaborate examples.
from pathlib import Path
import tiny_retriever as terry
urls = ["https://example.com/file1.pdf", "https://example.com/file2.pdf"]
paths = [Path("downloads/file1.pdf"), Path("downloads/file2.pdf")]
# or generate unique filenames
paths = (terry.unique_filename(u) for u in urls)
paths = [Path("downloads", p) for p in paths]
# Download files concurrently
terry.download(urls, paths)
urls = ["https://api.example.com/data1", "https://api.example.com/data2"]
# Get JSON responses
json_responses = terry.fetch(urls, "json")
# Get text responses
text_responses = terry.fetch(urls, "text")
# Get binary responses
binary_responses = terry.fetch(urls, "binary")
url = "https://api.example.com/data"
params = {"key": "value"}
# Generate unique filename based on URL and parameters
filename = terry.unique_filename(url, params=params, file_extension=".json")
Note that you can also pass a single url and a dictionary of request parameters to the
fetch
function. The default network related parameters are conservative and can be
modified as needed.
urls = "https://api.example.com/data"
kwargs = {"headers": {"Authorization": "Bearer token"}}
responses = terry.fetch(
urls,
return_type="json",
request_method="post",
request_kwargs=kwargs,
limit_per_host=2,
timeout=30,
)
from tiny_retriever import fetch, ServiceError
try:
responses = fetch(urls, return_type="json", raise_status=True)
except ServiceError as e:
print(f"Request failed: {e}")
TinyRetriever can be configured through environment variables:
MAX_CONCURRENT_CALLS
: Maximum number of concurrent requests (default: 10)We welcome contributions! Please see the contributing section for guidelines and instructions.
This project is licensed under the terms of the MIT license.
FAQs
A synchronous wrapper for AIOHTTP
We found that tiny-retriever demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
The MCP community is launching an official registry to standardize AI tool discovery and let agents dynamically find and install MCP servers.
Research
Security News
Socket uncovers an npm Trojan stealing crypto wallets and BullX credentials via obfuscated code and Telegram exfiltration.
Research
Security News
Malicious npm packages posing as developer tools target macOS Cursor IDE users, stealing credentials and modifying files to gain persistent backdoor access.