Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dvamishkilapa/aparser-async-api
Asyncio is an alternative module for working with A-parser.
https://github.com/dvamishkilapa/aparser-async-api
a-parser aiohttp aparser asyncio python3
Last synced: 21 days ago
JSON representation
Asyncio is an alternative module for working with A-parser.
- Host: GitHub
- URL: https://github.com/dvamishkilapa/aparser-async-api
- Owner: DvaMishkiLapa
- License: apache-2.0
- Created: 2023-05-12T11:04:18.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-05-12T14:13:31.000Z (over 1 year ago)
- Last Synced: 2024-12-01T19:05:24.590Z (about 1 month ago)
- Topics: a-parser, aiohttp, aparser, asyncio, python3
- Language: Python
- Homepage: https://pypi.org/project/aparser-async-api/
- Size: 11.7 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# aparser-async-api
Asyncio is an alternative [module api-python](https://github.com/a-parser/api-python) for working with A-parser.
- [aparser-async-api](#aparser-async-api)
- [1. Dependencies](#1-dependencies)
- [2. Implementation details](#2-implementation-details)
- [3. Usage example](#3-usage-example)## 1. Dependencies
- [`aiohttp` 3.8 or never](https://pypi.org/project/aiohttp/);
- [Python 3.7 or newer](https://www.python.org/).## 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
```python
import asynciofrom 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 itif __name__ == '__main__':
asyncio.run(main())
```