A-Parser Async Python Library
Overview
The A-Parser Async Python Library is a powerful, modern, and feature-rich solution for interacting with the A-Parser API using Python. Designed for developers who require robust and efficient API integration, this library leverages Python's asynchronous capabilities and the Pydantic library for schema validation, ensuring performance, reliability, and ease of use.
Key Features
🌟 Asynchronous API
The library is fully asynchronous, built on Python's asyncio and httpx to maximize performance and responsiveness. It allows for non-blocking API requests, enabling efficient parallel task management.
📜 Pydantic-Based Validation
Every request and response is validated using Pydantic models. This ensures data integrity, provides clear error messages, and reduces the risk of bugs caused by malformed data.
💡 Simplified API Integration
With thoughtfully designed methods, the library simplifies interaction with the A-Parser API, including task management, proxy checker control, and result retrieval.
🔧 Comprehensive Functionality
The library supports a wide range of features offered by the A-Parser API:
- Add tasks to the queue
- Retrieve task states and results
- Manage and delete tasks
- Control proxy checker states
- Handle task results with ease
Installation
pip install aparser-async
Usage
Import the Library
from aparser_async import AParser, schemas, AParserError
Initialize the Client
aparser = AParser(address="http://127.0.0.1", password="your_password", port=9091)
Examples
1. Ping the API
import asyncio
async def check_api():
response = await aparser.ping()
print(f"Ping response: {response}")
asyncio.run(check_api())
2. Add a Task
task_data = schemas.Data(
preset="example_preset",
parsers=[["parser1"], ["parser2"]],
queries="example_query"
)
async def create_task():
task_id = await aparser.add_task(task_data)
print(f"Task created with ID: {task_id}")
asyncio.run(create_task())
3. Get Task Status
async def get_status(task_id):
status = await aparser.get_task_state(task_id)
print(f"Task {task_id} Status: {status.status}")
asyncio.run(get_status(task_id=12345))
4. Wait for Task Completion
async def wait_for_task(task_id):
try:
await aparser.wait_for_task(task_id, delay=2, timeout=60)
print(f"Task {task_id} completed successfully!")
except AParserError as e:
print(f"Task {task_id} failed: {e}")
asyncio.run(wait_for_task(task_id=12345))
Benefits
🚀 Performance
Asynchronous programming allows you to handle multiple tasks efficiently, saving time and system resources.
✅ Reliability
The library ensures every interaction with the A-Parser API is validated, reducing the chance of runtime errors.
🛠️ Developer-Friendly
With clear documentation, intuitive APIs, and detailed logging, this library is designed for seamless integration into your Python projects.
Requirements
- Python 3.8+
- A running instance of A-Parser
httpxfor HTTP requestspydanticfor schema validation
Contributing
Contributions are welcome! Please fork the repository and submit a pull request with your changes. Ensure your code adheres to PEP 8 and includes tests for new functionality.
License
This library is licensed under the MIT License. See the LICENSE file for more details.
Acknowledgements
Special thanks to the developers of:
With A-Parser Async, managing your API tasks has never been easier or more efficient. 🎉
Metadata
Release files for aparser-async 0.0.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| aparser_async-0.0.4.tar.gz | 8.5 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| aparser_async-0.0.4-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 15.9 kB
Release files / aparser_async-0.0.4.tar.gz
| Download URL | aparser_async-0.0.4.tar.gz |
|---|---|
| Size | 8.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9f55c46337b6f26ec11b9830027854c8589669719f9f0df8829d417d58d3526c
|
|
BLAKE2b-256 checksum How to use checksums |
a70cb64ff441df36b1d15d3b4e2dcaded9bddd06ae2e6d94fe6d2d4c6df7decb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.2
|
Release files / aparser_async-0.0.4-py3-none-any.whl
| Download URL | aparser_async-0.0.4-py3-none-any.whl |
|---|---|
| Size | 7.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
cdab636664689e6a2e5da575bc0cfabd913c3ed8056e1c459b8aa0e21ecac960
|
|
BLAKE2b-256 checksum How to use checksums |
b73e827455d95ff65aae30988bc8601d8808343ea9742fbd17f9048912717f45
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.2
|
Security for aparser-async 0.0.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.