Skip to main content

nebx is a python "Swiss Army knife" to orchestrate existing python packages, reducing boilerplate codes

Project description

# nebx (nebulaspace)

nebx is a python "Swiss Army knife" to orchestrate existing python packages, reducing boilerplate codes.

Installation

Use the package manager pip to install nebx.

pip install nebx

Quick Usage Overview

import asyncio
from time import perf_counter

from nebx import RequestWrapperHttpx, HttpHeaderFaker, ConcurrentTaskManager
from nebx.interfaces import IRequestWrapper, IHttpHeaderFaker, IConcurrentTaskManager


async def main():
    task_manager: IConcurrentTaskManager = ConcurrentTaskManager()
    header_faker: IHttpHeaderFaker = HttpHeaderFaker()
    request: IRequestWrapper = RequestWrapperHttpx()

    start = perf_counter()
    for i in range(1, 100):
        header_faker.change_user_agent()
        coro = request.get(f"https://dummyjson.com/products/{i}", headers=header_faker.header)
        task = asyncio.create_task(coro)
        task_manager.add_task(task)

    responses = await task_manager.run_tasks()
    stop = perf_counter()
    print(stop - start, responses)
    await request.close()


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

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

nebx-0.1.1-py3-none-any.whl (9.1 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