Skip to main content

Asyncio is an alternative module for working with A-parser.

Project description

aparser-async-api

Asyncio is an alternative module api-python for working with A-parser.

1. Dependencies

2. Implementation details

Adaptation of synchronous code should require a minimum of effort. All method names are identical to the original ones. The structure of the class is also similar to the original.

3. Usage example

import asyncio

from aparser_async_api import AParser

APARSER_URL = '''your A-parser API URL'''
APARSER_PASS = '''your A-parser API password'''


async def main():
    task_id = 1
    api = AParser(APARSER_URL, APARSER_PASS)
    print(f'Ping: {await api.ping()}\n')
    print(f'A-parser Info: {await api.info()}\n')
    print(f'File link: {await api.getTaskResultsFile(task_id)}\n')
    print(f'Task state: {await api.getTaskState(task_id)}\n')
    print(f'Task config: {await api.getTaskConf(task_id)}\n')
    print(f'Task list: {await api.getTasksList()}')
    await api.close()  # Mandatory closure of the session `aiohttp.ClientSession` if you no longer need it


if __name__ == '__main__':
    asyncio.run(main())

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

aparser_async_api-1.0.1.tar.gz (7.7 kB view hashes)

Uploaded Source

Built Distribution

aparser_async_api-1.0.1-py3-none-any.whl (8.4 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page